This is a core module in Python

The random module generates random numbers. Currently, it uses the Mersenne Twister PRNG. The only functions that are important are getrandbits, random, shuffle, seed and randint.

Most important functions Edit

  • random.getrandbits(bits) - return bits of randomness
  • random.random() - return a random decimal number >= 0.0 but <= 1.0
  • random.shuffle(dict) - shuffle a dict and return the shuffled version
  • random.seed(seed) - seed the PRNG with seed, useful for debugging only, the PRNG is usually auto-seeded
  • random.randint(min, max) - return a random number >= min but <= max