for ( int i = 1; i <= 10; i=i+1 )
{
srand( time(0) );
int val = rand()%10 + 1;
cout << val << endl;
}
Show differencesHistory of post edits
#Actualfastcall22
Posted 27 December 2012 - 01:53 PM
It's not necessarily calling srand multiple times, it's beginners repeatedly calling srand with time(0) and making a "rand isn't random" thread on gamedev:
#1fastcall22
Posted 27 December 2012 - 01:52 PM
It's not necessarily calling srand multiple times, beginners repeatedly calling srand with time(0) and making a "rand isn't random" thread on gamedev:
for ( int i = 1; i <= 10; i=i+1 )
{
srand( time(0) );
cout << rand() % 10 << endl;
}