While using srand() in c++, I get segfault 1 out of 10 times. Any possible solution to that? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

While using srand() in c++, I get segfault 1 out of 10 times. Any possible solution to that?

It runs perfect the way I want 9 outta 10 times.

11th Feb 2017, 6:01 PM
Nishant Shah
Nishant Shah - avatar
1 Réponse
0
srand(time(null)); if u use rand to find an array index. make sure it isnt the size of the array. as that element doesnt exist.
19th Feb 2017, 7:49 PM
Michael Szczepanski
Michael Szczepanski - avatar