-
How?
how would u get different numbers in the 2 loops?
code:
#include <stdlib.h>
#include <time.h>
#include <iostream.h>
int funk1()
{
srand((unsigned)time(NULL));
int d=rand()%7;
cout<<d<<flush;
return 0;
}
int funk2()
{
srand((unsigned)time(NULL));
int d=rand()%7;
cout<<d<<flush;
return 0;
}
main()
{
funk1();
cout<<"--";
funk2();
return 0;
}
-
Loops? If you are talking about functions....you should only seed rand once.
~Barjor
-
yes only make one call to srand in the whole entire complete program.
Popular pages
Recent additions