pub struct BitGenerator { /* private fields */ }Expand description
A numpy BitGenerator usable without being attached to the interpreter runtime,
with exclusive access to its state.
spawn hands out independent, owned ones.
Implementations§
Source§impl BitGenerator
impl BitGenerator
Sourcepub fn new(py: Python<'_>, kind: BitGeneratorKind) -> PyResult<Self>
pub fn new(py: Python<'_>, kind: BitGeneratorKind) -> PyResult<Self>
Creates a fresh BitGenerator backed by numpy’s implementation.
use pyo3::prelude::*;
use numpy::random::{BitGenerator, BitGeneratorKind};
let mut bitgen = Python::attach(|py| BitGenerator::new(py, Default::default()))?;
println!("{}", bitgen.next_u32());Returns the underlying PyBitGenerator.
Sourcepub fn next_double(&mut self) -> f64
pub fn next_double(&mut self) -> f64
Returns the next random double.
Trait Implementations§
Source§impl RngCore for BitGenerator
Available on crate feature rand_core only.
impl RngCore for BitGenerator
Available on crate feature
rand_core only.impl Send for BitGenerator
Auto Trait Implementations§
impl !RefUnwindSafe for BitGenerator
impl !Sync for BitGenerator
impl Freeze for BitGenerator
impl Unpin for BitGenerator
impl UnsafeUnpin for BitGenerator
impl UnwindSafe for BitGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.