| ??? 12/25/03 21:12 Read: times |
#61388 - Random number from 1 to 8 |
I need to generate a random number from 1 to 8 using the rand() function which generates a random number from 0 to 32,767.
My first thought was to use the formula newRand = 1 + 7 * rand() / 32,767 The qustion is is my newRand variable as good random as the rand() function? can you think of a better way to generate random number from 1 to 8 using the rand() function. Mahmood |



