Ruby 3.2.1p31 (2023-02-08 revision 31819e82c88c6f8ecfaeb162519bfa26a14b21fd)
|
PRNG algorithmic interface, analogous to Ruby level classes. More...
#include <random.h>
Data Fields | |
size_t | default_seed_bits |
Number of bits of seed numbers. | |
struct { | |
uint8_t major | |
uint8_t minor | |
} | version |
Major/minor versions of this interface. | |
uint16_t | flags |
Reserved flags. | |
rb_random_init_func * | init |
Function to initialize from uint32_t array. | |
rb_random_init_int32_func * | init_int32 |
Function to initialize from single uint32_t. | |
rb_random_get_int32_func * | get_int32 |
Function to obtain a random integer. | |
rb_random_get_bytes_func * | get_bytes |
Function to obtain a series of random bytes. | |
rb_random_get_real_func * | get_real |
Function to obtain a random double. | |
PRNG algorithmic interface, analogous to Ruby level classes.
size_t rb_random_interface_t::default_seed_bits |
rb_random_get_bytes_func* rb_random_interface_t::get_bytes |
Function to obtain a series of random bytes.
If your PRNG have a native method to yield arbitrary number of bytes use that to implement this. But in case you lack such things, you can do so by using rb_rand_bytes_int32()
rb_random_get_int32_func* rb_random_interface_t::get_int32 |
rb_random_get_real_func* rb_random_interface_t::get_real |
Function to obtain a random double.
If your PRNG have a native method to yield a floating point random number use that to implement this. But in case you lack such things, you can do so by using rb_int_pair_to_real().
rb_random_init_func* rb_random_interface_t::init |
rb_random_init_int32_func* rb_random_interface_t::init_int32 |
struct { ... } rb_random_interface_t::version |
Major/minor versions of this interface.