#[repr(C)]pub struct rb_random_interface_t {
pub default_seed_bits: size_t,
pub version: rb_random_interface_t__bindgen_ty_1,
pub flags: u16,
pub init: rb_random_init_func,
pub init_int32: rb_random_init_int32_func,
pub get_int32: rb_random_get_int32_func,
pub get_bytes: rb_random_get_bytes_func,
pub get_real: rb_random_get_real_func,
}Expand description
Fields§
§default_seed_bits: size_t§version: rb_random_interface_t__bindgen_ty_1Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
flags: u16§init: rb_random_init_func§Function to initialize from uint32_t array.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
init_int32: rb_random_init_int32_func§Function to initialize from single uint32_t.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
get_int32: rb_random_get_int32_func§get_bytes: rb_random_get_bytes_funcFunction 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
extern [`rb_random_get_int32_func`] your_get_int32_func;
void
your_get_byes_func([`rb_random_t`] *rng, void *buf, size_t len)
{
[`rb_rand_bytes_int32`]your_get_int32_func, rng, buf, len);
}Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
get_real: rb_random_get_real_funcFunction 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.
extern [`rb_random_get_int32_func`] your_get_int32_func;
void
your_get_real_func([`rb_random_t`] *rng, int excl)
{
auto a = your_get_int32_func(rng);
auto b = your_get_int32_func(rng);
return [`rb_int_pair_to_real`]a, b, excl);
}Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
Trait Implementations§
Source§impl Clone for rb_random_interface_t
impl Clone for rb_random_interface_t
Source§fn clone(&self) -> rb_random_interface_t
fn clone(&self) -> rb_random_interface_t
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for rb_random_interface_t
impl Debug for rb_random_interface_t
Source§impl PartialEq for rb_random_interface_t
impl PartialEq for rb_random_interface_t
impl Copy for rb_random_interface_t
impl Eq for rb_random_interface_t
impl StructuralPartialEq for rb_random_interface_t
Auto Trait Implementations§
impl Freeze for rb_random_interface_t
impl RefUnwindSafe for rb_random_interface_t
impl Send for rb_random_interface_t
impl Sync for rb_random_interface_t
impl Unpin for rb_random_interface_t
impl UnwindSafe for rb_random_interface_t
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)