PDA

View Full Version : very simple Q about randomization



andr.in
September 8th, 2002, 10:24 AM
I know how to get a random number from 0 to XX:
random(xx) or Math.random()*XX;
but how to get a random number from 5 to 15 for example???
this little thingy is so annoying!

flex
September 8th, 2002, 10:58 AM
http://board.flashkit.com/board/showthread.php?threadid=364473

andr.in
September 8th, 2002, 11:54 AM
:)

blue_chi
September 9th, 2002, 02:42 AM
well you could've easily done it by doing:
(random(11)+5) the minimal value for random would be 0 add 5 to it and it would be 5 and the max of random would be 10 add 5 to it and it would be 15 .. so the value would range from 5 to 15.