+ 2
What is a seed value?
5 Antworten
+ 5
So use <ctime> !
to set seed value~
by
srand(time(0))
Cr.Sololearn n someone
+ 2
A seed in programming is a reference of random, if you force your random to reuse the same seed value, you will get the same "random" result.
+ 1
If you want a real random you should use
#include <ctime>
.
.
srand(time(0))
then your rand will be real rand.
+ 1
Generally speaking, most programming language do not provide purely random numbers, but *pseudo*random instead. That means they have an internal algorithm to produce a value, based on the previous result. A seed is an initial value for the sequence of those pseudorandom numbers.
0
Seed is an unsigned integer to pass as parameter in rand function to produce a different sequence of random numbers