Hi, I've scowered the forums for finding how too implement the random generator function inside of a class. I understand how it works inside the main function and how it runs.
What i am not familiar with is
1)how to 'seed' it in a class that will generator a random number.
2) how to return a random number without 'seeding' it every time in a function
I am using the method below in my main class.
1 2 3
srand(time(0));
for( int i = 0 ; i < 20; i ++)
cout << (rand()%5);
prior to this post. I used to do it in the following form
1 2 3 4
srand(time(0));
int i =(rand()%5);
return i;
I am under the impression this is 'reseeding' every time which is wrong! But I can not find a solid solution :(
below is an example of how i am trying to implement this. But i am not sure where to seed the numGenerator