I wrote this function to get a pseudo random float between 0 .. 1 inclusive:
float randomFloat() { float r = (float)rand()/(float)RAND_MAX; retur
You need to call
srand(time(NULL));
before using rand for the first time. time is in .
rand
time
EDIT: As Jonathan Leffler points out, this is easily predicted, so don't try using it for cryprography.