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!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponses
+ 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