Mojo module
random
Provides functions for random numbers.
You can import these APIs from the random package. For example:
from random import seedWarning: This module provides a pseudorandom number generator (PRNG) suitable for simulations, games, and general statistical purposes. It is NOT cryptographically secure and should not be used for security-sensitive applications such as generating passwords, authentication tokens, encryption keys, or any other security-critical random values.
Functions
-
rand: Fills memory with random values from a uniform distribution. -
randint: Fills memory with uniform random in range [low, high]. -
randn: Fills memory with random values from a Normal(mean, standard_deviation) distribution. -
randn_float64: Returns a random double sampled from a Normal(mean, standard_deviation) distribution. -
random_float64: Returns a randomFloat64number from the given range. -
random_si64: Returns a randomInt64number from the given range. -
random_ui64: Returns a randomUInt64number from the given range. -
seed: Seeds the random number generator using the current time. -
shuffle: Shuffles the elements of the list randomly.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!