0
problem with range of rand() operator
this code programmed to show random numbers in range of 1000 to 6000. but it shows numbers above 6000 too. like this numbers: 6381 1045 4918 4335 4074 1839 3396 2007 6705 2609 https://code.sololearn.com/c8C3yUDKQMCC/#cpp
2 Answers
0
Change rand() % 6000 to rand() % 5000
because you are already adding 1000.
let's consider: random no. 5500
1000 + 5500 % 6000 = 1000+ 5500 = 6500
0
https://code.sololearn.com/ck9ZNHwR6OS5/?ref=app
nevermind the rest of the code just look at setting up the range of rand here.