the current rand() is only a signed short does anyone know a better randmizer that would return a UINT or float?
Printable View
the current rand() is only a signed short does anyone know a better randmizer that would return a UINT or float?
First RAND_MAX isn't guaranteed to be a short
If you want a larger rand, then simply do something like rand() * rand()
If you want a float in the range 0..1, then do (float)rand() / RAND_MAX, and scale accordingly
thanks for the info
You can try the Mersenne Twister algorithm.
Someone has implemented it in C++ here:
http://www-personal.engin.umich.edu/...neTwister.html