Better seeds than time(0)?

前端 未结 11 1828
挽巷
挽巷 2021-01-02 08:06

I understand that time(0) is commonly using for seeding random number generators and that it only becomes a problem when the program is being run more than once per second.

11条回答
  •  一生所求
    2021-01-02 08:51

    Since you're already using boost, you probably want boost::random_device.

    (At least on Linux. I don't recall whether the obvious CryptGenRandom implementation of it is yet available on Windows.)

提交回复
热议问题