pub struct DefaultRand { /* private fields */ }
Expand description
Default random generator which is good for most applications.
This currently uses Xoroshiro128StarStar
, but that may be changed in the future (with a major version bump).
Implementations§
Source§impl DefaultRand
impl DefaultRand
Sourcepub fn initialize_states(seed: u64, num_states: usize) -> Vec<Self>
Available on non-target_os="cuda"
only.
pub fn initialize_states(seed: u64, num_states: usize) -> Vec<Self>
target_os="cuda"
only.Initializes many states such that each state is offset in the main sequence by at least
2**64
elements (based on the current default generator). Such that every state is independent
from the others as long as no state requests more than 2**64
random numbers.
Trait Implementations§
Source§impl Clone for DefaultRand
impl Clone for DefaultRand
Source§fn clone(&self) -> DefaultRand
fn clone(&self) -> DefaultRand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DefaultRand
impl Debug for DefaultRand
Source§impl PartialEq for DefaultRand
impl PartialEq for DefaultRand
Source§impl RngCore for DefaultRand
impl RngCore for DefaultRand
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moreSource§impl SeedableRng for DefaultRand
impl SeedableRng for DefaultRand
Source§type Seed = <Xoroshiro128StarStar as SeedableRng>::Seed
type Seed = <Xoroshiro128StarStar as SeedableRng>::Seed
Seed type, which is restricted to types mutably-dereferenceable as
u8
arrays (we recommend [u8; N]
for some N
). Read moreSource§fn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64
seed. Read moreimpl Copy for DefaultRand
impl DeviceCopy for DefaultRand
impl Eq for DefaultRand
impl StructuralPartialEq for DefaultRand
Auto Trait Implementations§
impl Freeze for DefaultRand
impl RefUnwindSafe for DefaultRand
impl Send for DefaultRand
impl Sync for DefaultRand
impl Unpin for DefaultRand
impl UnwindSafe for DefaultRand
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GpuRand for Twhere
T: RngCore,
impl<T> GpuRand for Twhere
T: RngCore,
Source§fn uniform_f32(&mut self) -> f32
fn uniform_f32(&mut self) -> f32
Creates an
f32
in the range of [0.0, 1.0)
and advances the state once.Source§fn uniform_f64(&mut self) -> f64
fn uniform_f64(&mut self) -> f64
Creates an
f64
in the range of [0.0, 1.0)
and advances the state once.Source§fn normal_f32(&mut self) -> f32
fn normal_f32(&mut self) -> f32
Creates an
f32
with normal distribution. The value is drawn from a Gaussian of
mean=0 and sigma=1 using the Box-Mueller transform. Advances the state twice.Source§fn normal_f64(&mut self) -> f64
fn normal_f64(&mut self) -> f64
Creates an
f64
with normal distribution. The value is drawn from a Gaussian of
mean=0 and sigma=1 using the Box-Mueller transform. Advances the state twice.Source§fn normal_f32_2(&mut self) -> [f32; 2]
fn normal_f32_2(&mut self) -> [f32; 2]
Same as
Self::normal_f32
but doesn’t discard the second normal value.Source§fn normal_f64_2(&mut self) -> [f64; 2]
fn normal_f64_2(&mut self) -> [f64; 2]
Same as
Self::normal_f64
but doesn’t discard the second normal value.