Charles Brunet Charles Brunet - 2 years ago 84
Python Question

How to generate a "big" random number in Python?

How can I generate a big (more than 64 bits) random integer in Python?

Answer Source

You can use random.getrandbits():

>>> random.getrandbits(128)

As states in the linked documentation, random.randrange() will also do the trick if random.getrandbits() is available.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download