Reputation: 325
I understand that I should use os.urandom()
or SystemRandom
in Python for 'secure' pseudo-random numbers.
But how does Python generate these random numbers logically?
Also is there a way to generate a number in Python that is 'more random' than others?
Upvotes: 8
Views: 5353
Reputation: 34563
For "secure" random numbers, Python doesn't actually generate them: it gets them from the operating system, which has a special driver that gathers entropy from various real-world sources, such as variations in timing between keystrokes and disk seeks.
Upvotes: 7