random for as3?(solved)

Subscribe to random for as3?(solved) 5 posts

avatar for gulzaibthegreat1 gulzaibthegr... 291 posts
Flag Post

what is equivalent of random (in as2) in as3?

by this i mean in as2 an example would be i said random(10) than it would choose a random number between 0 and 10.

 
avatar for Khronosis Khronosis 130 posts
Flag Post

Please read the manual:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Math.html


‘random()’ generates a number in the range 0 <= n < 1, so if you want a random number between 0 and 10, you would multiply the result by 10, as such:

Math.random() * 10;

 
avatar for BraydenBlack BraydenBlack 271 posts
Flag Post

I found this tutorial helpful actually when i was learning. And Math.random() is in as2 and as3

 
avatar for lobstershow lobstershow 1096 posts
Flag Post

0 <= n <= 1 ain’t it?

 
avatar for UnknownGuardian UnknownGuardian 8142 posts
Flag Post

Nope, it will never generate 1.