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)
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
you can do
Do you know this library: PyRandLib? See:
This library contains many of the best-in-class pseudo-random numbers generators while acting exactly as does the Python "built-in" library random (just un-zip or un-tar the downloaded archive in the 'Lib/site-packages/' sub-directory of your Python directory).
From the code, and from module 'fastrand32.py', you'll get a quite more sophisticated way to feed random with a shuffled version of current time. For your purpose, this would become:
This provides a main advantage: for very short periods of time, the initial seeds for feeding the pseudo-random generator will be hugely different between two successive calls.