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 t
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()
orSystemRandom
if you require a cryptographically secure pseudo-random number generator.
Python has nothing that allows you to generate "truly random" or "authentic random" numbers, in the sense that they are uniformly distributed and independent of everything else (especially the latter).
In any case, the distinction between "pseudorandom" and "truly random" numbers is not what applications care about. Rather, the requirements for randomness depend on the application, and you didn't really specify what kind of application you have in mind. For example, in general:
secrets
module or random.SystemRandom
.numpy.random.Generator
or random.Random
.See also these questions:
https://www.random.org/integers/
https://api.random.org/json-rpc/1/
This website generates random numbers through atmospheric white noise, which is better than pseudo random numbers for use with development, You can also use there API for automated random numbers (Though it won't be free for long as it's currently in beta.)
Another method of obtaining true random numbers is through the quantum random number generator, http://photonics.anu.edu.au/qoptics/Research/qrng.php.
To reiterate what someone said earlier, you should avoid using computationally made pseudo random numbers for security purposes.
Truly random numbers can be generated from
https://pypi.python.org/pypi/quantumrandom/
pip install quantumrandom
Currently you are limited to blocks of 1024 but with a bit of simple programming and a little bit of time you will be able to extend this limit to a large enough sample for most applications.