What‘s the difference between srand(1) and srand(0)

后端 未结 7 2232
广开言路
广开言路 2020-12-30 02:23

I just found out the hard way that srand(1) resets the PRNG of C(++) to the state before any call to srand (as defined in the reference). However,

7条回答
  •  情深已故
    2020-12-30 03:03

    If seed is set to 1, the generator is reinitialized to its initial value and produces the same values as before any call to rand or srand. Taken from the srand reference

提交回复
热议问题