Hi, I would need help on a randomize number function
I included
#include<ctime>
and below is my randomize function (Noted that I am just randomize between 0 and 1).
int randomVH()
{
int num;
srand(time(0));
num=(rand()%2);
return num;
}
This is partial code in my main. (Noted that I am generating 100 numbers.)
for(;counter<100;counter++)
{
num=randomVH();
cout<<counter<<"\t"<<num<<endl;
}
With this code, somehow I am generating the same number inside this loop. I am hopping if anyone can fix my random function for me so I can generate number instead of same number inside the loop.