Math.random() //generates a random number. Math.random * 5;//multiplies it by five (int)Math.random * 5; //does type conversion to int, incase it may be of float type int y = (int)Math.random * 5 // stores the value to y if i am not mistaken Math.random generates random numbers between the range of 0 to 1. (but just check up on that again) cheers ak.
That is correct. Math.random() generates a random number from 0 to 1 with equal probability each time (uniform distribution). [This message has been edited by Brien Hackney (edited October 12, 2000).]