|
Ruby
3.1.4p223 (2023-03-30 revision HEAD)
|
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... | |
| rb_random_init_func * | init |
| Initialiser function. 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 |