I want to use rand function that generate numbers form number bigger than RAND_MAX.
how can i do this?
thanks,
maya
1 2 3 4 5
|
// assuming RAND_MAX is 2^32-1
u64 rand64()
{
return ((u64)rand() << 32) | rand();
}
|
EDIT: actually... nevermind.
This would have poor distribution because you'd still have a period of 2^32.
Maybe you are better off writing your own.
Last edited on