C++ random numbers

前端 未结 7 1069
生来不讨喜
生来不讨喜 2021-01-20 05:55

At the following: http://www.fredosaurus.com/notes-cpp/misc/random.html

It mentions that if we want to generate a random number in the range 1-10, we ca

7条回答
  •  执笔经年
    2021-01-20 06:20

    Why do we add 1?

    When you divide a number by 10, remainders will be between 0-9. So, to change this we add 1.

提交回复
热议问题