+ 1

Random

I am making a slot machine and my random numbers keep on codeing out the same please help me

21st Nov 2017, 7:42 PM
Jackson Warren
Jackson Warren - avatar
4 Respostas
+ 7
You didn't seed the random number generator so it always repeats the same pattern. This makes it easy to debug as you end up executing exactly the same way each time. Normally, the seed is done by: #include <ctime> ... srand(time(nullptr));
21st Nov 2017, 8:07 PM
John Wells
John Wells - avatar
+ 4
What's your code? Post it up for us in the Code Playground. https://www.sololearn.com/Codes/
21st Nov 2017, 7:45 PM
AgentSmith
+ 2
https://code.sololearn.com/ciinkVXpRYuM/?ref=app
21st Nov 2017, 7:48 PM
Jackson Warren
Jackson Warren - avatar