what is the function to find a random number between any 2 declared numbers in win32 opengl programming?
thank you!
what is the function to find a random number between any 2 declared numbers in win32 opengl programming?
thank you!
There is a function rand in C++ that calculates random integer number between predefined 0 and RAND_MAX constant
Try this function:
#include <stdlib.h>
//-----------------------
float RandAB(float A, float B)
{
return A+(B-A)*rand()/RAND_MAX;
}
If you dont use C++, your language should have function for generation of random numbers.
As far as I know, there is no special random function in Win32 or 3D graphics programming. I can well be wrong.
If you want t something a bit closer to random…
try
Mersenne Twister
or
Taygata
they both have code on the web and are really easy to pop into your code…
gav