vendredi 30 septembre 2016

How to make a True Random with equal chance in AS3?

I'm developing a rock-paper-scissor game player vs computer. There's nothing special except player playing 3 rounds per game.

I'm using this code to generate random number from 1 to 3

Math.floor(Math.random()*(1+3-1))+1

1 = Scissor, 2 = Paper, 3 = Rock

I'm not sure but this code favor on Number 2.

Meaning the computer generate Paper-Paper-Paper so the player notice it and taking the advantage and select scissor-scissor-scissor. I bet you will do it also.

How can I generate real random in AS3?

Aucun commentaire:

Enregistrer un commentaire