The world's easiest, most powerful random function.
This script helps Python developers code randomness more simply, readably, and securely.
python main.py
random.seed([X], version=2) # Initialization of the random number generator. If X is not specified, the system time is used.
random.getstate() # The internal state of the generator.
random.setstate(state) # Restores the internal state of the generator. The state parameter must be obtained by the getstate () function.
random.getrandbits(N) # Returns N random bits.
random.randrange(start, stop, step) # Returns a randomly selected number from the sequence.
random.randint(A, B) # Random integer N, A ≤ N ≤ B.
random.choice(sequence) # A random element of a non-empty sequence.
random.random() # A random number from 0 to 1.
random.uniform(A, B) # A random floating-point number, A ≤ N ≤ B (or B ≤ N ≤ A).
random.sample(population, k) # A list of length k from the population sequence.
random.triangular(low, high, mode) # A random floating-point number, low ≤ N ≤ high. Mode-distribution.
random.shuffle(sequence, [rand]) # Shuffles the sequence (the sequence itself changes). Therefore, the function does not work for immutable objects.
random.betavariate(alpha, beta) # Beta distribution. alpha>0, beta>0. Returns from 0 to 1.
random.expovariate(lambd) # Exponential distribution. lambd is equal to 1/the desired average. The Lambd must be non-zero.
random.gammavariate(alpha, beta) # Gamma distribution. Conditions for the parameters alpha>0 and beta>0.
random.gauss(value, standard deviation) # The Gaussian distribution.
random.lognormvariate(mu, sigma) # The logarithm of the normal distribution.
random.normalvariate(mu, sigma) # Normal distribution. mu is the average value, sigma is the standard deviation.
random.vonmisesvariate(mu, kappa) # mu is the average angle expressed in radians from 0 to 2π, and kappa is the concentration parameter, which must be greater than or equal to zero.
random.paretovariate(alpha) # Pareto distribution.
random.weibullvariate(alpha, beta) # The Weibull distribution.