Creating a "uncrackable" "random" number with Python

python

Solution

You can use `random.SystemRandom` if it's available on your system:

http://docs.python.org/2/library/random.html#random.SystemRandom

Class that uses the `os.urandom()` function for generating random numbers from sources provided by the operating system. Not available on all systems. Does not rely on software state and sequences are not reproducible.

http://docs.python.org/2/library/os.html#os.urandom

Return a string of n random bytes suitable for cryptographic use.

This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation.

e.g.

>>> import sys
>>> import random
>>> rng = random.SystemRandom()
>>> rng.random()
0.7195432667967437
>>> rng.randint(0, sys.maxint)
3614556690529452993

Problem

It has been said that Python's random number generator relies on ``` time ``` which means if i wanted to create a random number like this ``` 23987429038409238409283 ``` and store it into the browser cookies for "authentication" it is possible some one can find this number based on "time". so the question is, how do i create a random number that can not be guessed by others that know a-lot about codes. ?

Original source