pub struct RandomState { /* private fields */ }Expand description
Legacy MT19937 with NumPy’s integer-seed initialization and draw order.
Implementations§
Source§impl RandomState
impl RandomState
Sourcepub fn next_u32(&mut self) -> u32
pub fn next_u32(&mut self) -> u32
One tempered 32-bit MT19937 output (also the full-width uint32 randint).
Sourcepub fn random_sample(&mut self) -> f64
pub fn random_sample(&mut self) -> f64
A 53-bit double in [0, 1), consuming two 32-bit outputs.
Sourcepub fn uniform(&mut self, low: f64, high: f64) -> Result<f64, DspError>
pub fn uniform(&mut self, low: f64, high: f64) -> Result<f64, DspError>
Scalar NumPy uniform(low, high), including a draw when low == high.
Bounds must be finite and ordered, with a finite difference.
Sourcepub fn randint(&mut self, high: usize) -> Result<usize, DspError>
pub fn randint(&mut self, high: usize) -> Result<usize, DspError>
NumPy’s legacy randint(high) for the nonnegative index domain used by DE.
Unlike modern Generator integers this uses masked rejection, not Lemire.
high == 1 returns zero without advancing the generator.
Sourcepub fn shuffle<T>(&mut self, values: &mut [T])
pub fn shuffle<T>(&mut self, values: &mut [T])
In-place legacy shuffle of a one-dimensional sequence, last index first.
Sourcepub fn permutation(&mut self, n: usize) -> Vec<usize>
pub fn permutation(&mut self, n: usize) -> Vec<usize>
NumPy permutation(range(n)) (the same stream as permutation(n)).
Trait Implementations§
Source§impl Clone for RandomState
impl Clone for RandomState
Auto Trait Implementations§
impl Freeze for RandomState
impl RefUnwindSafe for RandomState
impl Send for RandomState
impl Sync for RandomState
impl Unpin for RandomState
impl UnsafeUnpin for RandomState
impl UnwindSafe for RandomState
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