Daniela
15th October 2008, 11:20
Hello!
:confused:
I'm doing a random number in MacOs, but it returns always the same number. i use this:
#include <ctime> // To seed random generator
// Randomize
qsrand( time(0) );
//to get a random number i use this funtion:
int myClasse::randInt( int a, int b )
{
qsrand( time(0) );
return a + rand() % ( b - a + 1 );
}
but it always return the same number. Why this happens?
Thanks for read this post...
:confused:
I'm doing a random number in MacOs, but it returns always the same number. i use this:
#include <ctime> // To seed random generator
// Randomize
qsrand( time(0) );
//to get a random number i use this funtion:
int myClasse::randInt( int a, int b )
{
qsrand( time(0) );
return a + rand() % ( b - a + 1 );
}
but it always return the same number. Why this happens?
Thanks for read this post...