What is a seed value and how is it used in the rand function algorithm | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is a seed value and how is it used in the rand function algorithm

18th Dec 2018, 8:50 AM
Mobit Diraine Akumcha
Mobit Diraine Akumcha - avatar
2 Answers
+ 3
A seed value is used to initialize the random number generator. If you run a program multiple times with the same seed value, you'll always get the same "random" numbers. In languages like C(++) you usually use the time as seed (something like srand((unsigned)time(NULL))). That way it is more or less guaranteed that you'll get "unique" (pseudo) random numbers every time you run the program
18th Dec 2018, 9:16 AM
Anna
Anna - avatar
+ 2
Thanks Anna
30th Dec 2018, 10:01 AM
Mobit Diraine Akumcha
Mobit Diraine Akumcha - avatar