Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

rand

Random Number Generation (f128)

Pseudo-random number generation utilities using 64.64 fixed-point.

Functions

  • derive - Derive a new seed from an existing seed and entropy
  • fixed_between - Random fixed-point in range [low, high)
  • u128_between - Random u128 in range [low, high)
  • fixed_normal_between - Normally distributed random (approximation)
  • u128_normal_between - Normally distributed u128 (approximation)

Note

These are deterministic pseudo-random generators suitable for games and simulations, not for cryptographic purposes.

Fully qualified path: cairo_fp::f128::procgen::rand

Free functions

deriveDerives a new seed by hashing the current seed with entropy.
fixed_betweenReturns a pseudo-random fixed-point value in range [ low, high). The value is deterministic based on the seed.
u128_between
fixed_normal_between
u128_normal_between
_fixed_normal_between_loop