Python's random: What happens if I don't use seed(someValue)?

前端 未结 3 1722
迷失自我
迷失自我 2020-12-06 16:30

a)In this case does the random number generator uses the system\'s clock (making the seed change) on each run?

b)Is the seed used to generate the pseudo-random valu

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 17:11

    current system time is used; current system time is also used to initialize the generator when the module is first imported. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability).

    Random Docs

提交回复
热议问题