Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I generate authentic random number with python?

Tags:

python

random

I'm learning random module of python. And I know it generates pseudo random number. Which its core idea is to use a high-frequency clock as a seed and then use a function to produce a 'looking-like random number.

As I know it's even impossible to produce authentic random number in the real world.

But I know Unix random producer has introduced some other factors such as the parameter of mouse-movement track, the IO response time, to introduce uncertainty to its random number producer function. Through which we can get a better random number than normal pseudo random number. It's much more harder to predict.

So, is there a way that in python we can produce such a random number, or maybe import a good third party library?

like image 858
Zen Avatar asked Apr 06 '14 08:04

Zen


1 Answers

The documentation for the random module has this to say:

Warning: The pseudo-random generators of this module should not be used for security purposes. Use os.urandom() or SystemRandom if you require a cryptographically secure pseudo-random number generator.

like image 74
Andrew Gorcester Avatar answered Oct 11 '22 16:10

Andrew Gorcester