I have a question we are suppose to input a seed value for a randon number generator, but I am having issues with using the srand(seed), but the problem is I am getting the same output every time for the random numbers how can I do it with the user entering a seed not srand(time(null)) and get differn't random numbers.
skiing
0
Newbie Poster
Recommended Answers
Jump to PostSomething like this ? Don't know why you would wan't to do this
for.for(int i = 0 ; i < 100; i++) { cout<<"Enter a seed value : "; int seed = 0; cin >> seed; while(seed < 0) { cout<<"\nEnter non negative number : "; …
Jump to PostI know that but how about if you are only to enter a seed number one time to initialize the integer generator rand()?
Then put the seeding before the loop, not inside the loop:
cout<<"Enter a seed value : "; int seed = 0; cin >> seed; …
All 5 Replies
mrnutty
761
Senior Poster
skiing
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
VernonDozier
2,218
Posting Expert
Featured Poster
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.