IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

random_float64

random_float64(min: Float64 = Float64("0"), max: Float64 = Float64("1")) -> Float64

Returns a random Float64 number from the given range [min, max).

Example:

from std.random import random_float64, seed

seed()
var rnd = random_float64(10.0, 20.0)
print(rnd) # Random float between 10.0 and 20.0

Args:

  • min (Float64): The minimum number in the range (inclusive, default is 0.0).
  • max (Float64): The maximum number in the range (exclusive, default is 1.0).

Returns:

Float64: A random number sampled uniformly from [min, max).