Why do I always know what the next random number will be? it doesn't look like a random number generator. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do I always know what the next random number will be? it doesn't look like a random number generator.

7th Oct 2019, 6:00 PM
Alsifer
Alsifer - avatar
3 Answers
+ 4
Alsifer use the srand () function together with rand () so you won’t know what number will be https://code.sololearn.com/cQs37UQ8Eh8g/?ref=app
7th Oct 2019, 6:20 PM
greedy fox
greedy fox - avatar
+ 2
it's in the tutorial; you need to use srand(time(0)) and you need to:- #include <cstdlib> #include <ctime>
7th Oct 2019, 6:22 PM
rodwynnejones
rodwynnejones - avatar
0
THANK. I just got to this point
7th Oct 2019, 6:22 PM
Alsifer
Alsifer - avatar