Random Module

Random Module

ยท

2 min read

  1. seed()

    • Initialize the random number generator
  2. getstate()

    • Returns the current internal state of the random number generator
  3. setstate()

    • Restores the internal state of the random number generator
  4. getrandbits()

    • Returns a number representing the random bits
  5. randrange()

    • Returns a random number between the given range
  6. randint()

    • Returns a random number between the given numbers
  7. choice()

    • Returns a random element from the given sequence
  8. choices()

    • Returns a list with a random selection from the given sequence
  9. shuffle()

    • Takes a sequence and returns the sequence in a random order
  10. sample()

    • Returns a given sample of a sequence
  11. random()

    • Returns a random float number between 0 and 1
  12. uniform()

    • Returns a random float number between two given parameters
  13. triangular()

    • Returns a random float number between two given parameters, you can also set a mode parameter to specify the midpoint between the two other parameters

Statistics

  1. betavariate()

    • Returns a random float number between 0 and 1 based on the Beta distribution
  2. expovariate()

    • Returns a random float number based on the Exponential distribution
  3. gammavariate()

    • Returns a random float number based on the Gamma distribution
  4. weibullvariate()

    • Returns a random float number based on the Weibull distribution

Probability

  1. gauss()

    • Returns a random float number based on the Gaussian distribution
  2. lognormvariate()

    • Returns a random float number based on a log-normal distribution
  3. normalvariate()

    • Returns a random float number based on the normal distribution
  4. paretovariate()

    • Returns a random float number based on the Pareto distribution

Directional Statistics

  1. vonmisesvariate()

    • Returns a random float number based on the von Mises distribution

Did you find this article valuable?

Support BigSmoke's Blog by becoming a sponsor. Any amount is appreciated!

ย