I wrote this code to generate a sequence of random number but this program give me the same random number:
int _tmain(int argc, _TCHAR* argv[])
{
for (int i=0;i<100;i++){
srand((unsigned)time(0));
cout<<"\t"<<rand();
}
getchar();
return 0;
}
the output is a sequence with equal number how i can solve this problem.
Aucun commentaire:
Enregistrer un commentaire