Ruby 3.4.5p51 (2025-07-16 revision 20cda200d3ce092571d0b5d342dadca69636cb0f)
|
MT19937 backended pseudo random number generator. More...
Go to the source code of this file.
Functions | |
unsigned int | rb_genrand_int32 (void) |
Generates a 32 bit random number. | |
double | rb_genrand_real (void) |
Generates a double random number. | |
void | rb_reset_random_seed (void) |
Resets the RNG behind rb_genrand_int32()/rb_genrand_real(). | |
VALUE | rb_random_bytes (VALUE rnd, long n) |
Generates a String of random bytes. | |
unsigned int | rb_random_int32 (VALUE rnd) |
Identical to rb_genrand_int32(), except it generates using the passed RNG. | |
double | rb_random_real (VALUE rnd) |
Identical to rb_genrand_real(), except it generates using the passed RNG. | |
unsigned long | rb_random_ulong_limited (VALUE rnd, unsigned long limit) |
Identical to rb_genrand_ulong_limited(), except it generates using the passed RNG. | |
unsigned long | rb_genrand_ulong_limited (unsigned long i) |
Generates a random number whose upper limit is i. |
MT19937 backended pseudo random number generator.
Definition in file random.h.
unsigned int rb_genrand_int32 | ( | void | ) |
double rb_genrand_real | ( | void | ) |
Generates a double random number.
unsigned long rb_genrand_ulong_limited | ( | unsigned long | i | ) |
Generates a String of random bytes.
[in,out] | rnd | An instance of rb_cRandom. |
[in] | n | Requested number of bytes. |
Definition at line 1324 of file random.c.
Referenced by rb_random_bytes().
unsigned int rb_random_int32 | ( | VALUE | rnd | ) |
Identical to rb_genrand_int32(), except it generates using the passed RNG.
[in,out] | rnd | An instance of rb_cRandom. |
double rb_random_real | ( | VALUE | rnd | ) |
Identical to rb_genrand_real(), except it generates using the passed RNG.
[in,out] | rnd | An instance of rb_cRandom. |
unsigned long rb_random_ulong_limited | ( | VALUE | rnd, |
unsigned long | limit ) |
Identical to rb_genrand_ulong_limited(), except it generates using the passed RNG.
[in,out] | rnd | An instance of rb_cRandom. |
[in] | limit | Max possible return value. |
Definition at line 1226 of file random.c.
Referenced by rb_random_ulong_limited().
void rb_reset_random_seed | ( | void | ) |
Resets the RNG behind rb_genrand_int32()/rb_genrand_real().