Ruby
3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
|
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. More... | |
double | rb_genrand_real (void) |
Generates a double random number. More... | |
void | rb_reset_random_seed (void) |
Resets the RNG behind rb_genrand_int32()/rb_genrand_real(). More... | |
VALUE | rb_random_bytes (VALUE rnd, long n) |
Generates a String of random bytes. More... | |
unsigned int | rb_random_int32 (VALUE rnd) |
Identical to rb_genrand_int32(), except it generates using the passed RNG. More... | |
double | rb_random_real (VALUE rnd) |
Identical to rb_genrand_real(), except it generates using the passed RNG. More... | |
unsigned long | rb_random_ulong_limited (VALUE rnd, unsigned long limit) |
Identical to rb_genrand_ulong_limited(), except it generates using the passed RNG. More... | |
unsigned long | rb_genrand_ulong_limited (unsigned long i) |
Generates a random number whose upper limit is i . More... | |
MT19937 backended pseudo random number generator.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. 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. |
n
bytes length, whose contents are random bits. 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. |
[0, limit]
interval. limit
. void rb_reset_random_seed | ( | void | ) |
Resets the RNG behind rb_genrand_int32()/rb_genrand_real().