Random number generator - why seed every time

前端 未结 7 2055
轻奢々
轻奢々 2020-12-06 04:58

I am relative new to c and c++. In java, the language I am used to program in, its very easy to implement random number generation. Just call the the static random-method fr

7条回答
  •  一个人的身影
    2020-12-06 05:46

    If you don't seed the generator, it will have the same seed every time you run your program, and the random number sequence will be the same each time.

    Also note that you only should to seed the generator once, at the beginning of the program.

提交回复
热议问题