Skip to content
Advertisement

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)

Advertisement

Answer

import random
from datetime import datetime
random.seed(datetime.now().timestamp())
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement