How does srand relate to rand function?

后端 未结 4 1947
你的背包
你的背包 2020-12-02 17:39

I understand that rand() function generates the same number(s) each you run it if you don\'t change the seed number. That\'s where srand() comes in. Time is always changing

4条回答
  •  日久生厌
    2020-12-02 18:04

    The random number seed is a global static variable. rand and srand both have access to it.

提交回复
热议问题