Ruby
3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
|
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. More... | |
struct { | |
uint8_t major | |
uint8_t minor | |
} | version |
Major/minor versions of this interface. More... | |
uint16_t | flags |
Reserved flags. More... | |
rb_random_init_func * | init |
Function to initialize from uint32_t array. More... | |
rb_random_init_int32_func * | init_int32 |
Function to initialize from single uint32_t. More... | |
rb_random_get_int32_func * | get_int32 |
Function to obtain a random integer. More... | |
rb_random_get_bytes_func * | get_bytes |
Function to obtain a series of random bytes. More... | |
rb_random_get_real_func * | get_real |
Function to obtain a random double. More... | |
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.