PDA

View Full Version : random numbers tutorial



Scootman
January 19th, 2003, 01:18 AM
just to point somthin out kirupa... its actually
Math.random()*(high-low)+low;
because if you do
Math.random()*70 + 7;
it will give you between 7 and 77... because if the random number returns 70 it will add 7 to it... just to point that out if you wanna change it in your tutorial...:cool:

Gedankenspiel
January 21st, 2003, 02:46 PM
On the subject of random numbers in Flash: I just used the syntac random() in an MX project and it works just fine. However, I get repetitive number sequences a lot.

With your approach will I get a more diversified results set?

G

Gedankenspiel
January 21st, 2003, 03:02 PM
Nevermind - tried it out and it works much better ;).

Thanks

senocular
January 21st, 2003, 03:23 PM
see http://www.kirupaforum.com/showthread.php?s=&threadid=11686#post81565

pom
January 21st, 2003, 06:12 PM
Lovely thread. I put it in the best of. And Scootman, thanks for spotting that :)

Scootman
January 21st, 2003, 11:29 PM
no problem, in school im learning programming, c++ mostly, but random numbers we used a lot in the beginning and that just kinda jumped out at me, glad i could help

kirupa
January 22nd, 2003, 10:33 AM
Thanks scootman for pointing the error out. I just fixed it.

Cheers!
Kirupa :eye: