Why it keeps putting out 41 for one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why it keeps putting out 41 for one?

I expect it to put out different number each time I run the program.

26th Dec 2016, 12:18 AM
Wilson Bol
Wilson Bol - avatar
2 Answers
+ 4
Share the code so we can check what's happening
26th Dec 2016, 12:25 AM
Nahuel
Nahuel - avatar
+ 1
rand() is pseudo-random. You need to seed the generator. (srand)
26th Dec 2016, 1:46 AM
Madison
Madison - avatar