Skip to main content
Log in

Mojo module

random

Provides functions for random numbers.

You can import these APIs from the random package. For example:

from random import seed

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, variance) distribution.
  • ​randn_float64: Returns a random double sampled from a Normal(mean, variance) distribution.
  • ​random_float64: Returns a random Float64 number from the given range.
  • ​random_si64: Returns a random Int64 number from the given range.
  • ​random_ui64: Returns a random UInt64 number from the given range.
  • ​seed: Seeds the random number generator using the current time.

Was this page helpful?