Sunday, July 26, 2009

Math.Random()

math.random() generates a number between 0 and 1. If you do *X(x=any integer), it changes the math.random() to 0-9, then you can do +1 to change it to 1-10.

Eg. For generating random values in the range 35 - 55, look at the following example:
Math.floor((math.random() * 35) + 55)

~nirmal

No comments:

Post a Comment