Module artichoke_backend::extn::core::random[][src]

Expand description

Random provides an interface to Ruby’s pseudo-random number generator, or PRNG. The PRNG produces a deterministic sequence of bits which approximate true randomness. The sequence may be represented by integers, floats, or binary strings.

This module implements the Random singleton object from Ruby Core.

In Artichoke, Random is implemented using a modified Mersenne Twister that reproduces the same byte and float sequences as the MRI implementation.

You can use this class in your application by accessing it directly. As a Core API, it is globally available:

r =


FFI glue between the Rust trampolines and the mruby C interpreter.

Glue between mruby FFI and ENV Rust implementation.



A range constraint for generating random numbers.

A generated random number.