@George

Sorry my bad about float, int; However I found this (Note the conversion to double in the proccess):

From the C FAQ:

13.16: How can I get random integers in a certain range?

A: The obvious way,

rand() % N /* POOR */

(which tries to return numbers from 0 to N-1) is poor, because

the low-order bits of many random number generators are

distressingly *non*-random. (See question 13.18.) A better

method is something like

(int)((double)rand() / ((double)RAND_MAX + 1) * N)

If you're worried about using floating point, you could use

rand() / (RAND_MAX / N + 1)