Search code examples
pythonrandomtime

Python: Random System time seed


In python, and assuming I'm on a system which has a random seed generator, how do I get random.seed() to use system time instead? (As if /dev/urandom did not exist)


Solution

  • import random
    from datetime import datetime
    random.seed(datetime.now().timestamp())