Struct rand_isaac::isaac64::Isaac64Core
source · [−]pub struct Isaac64Core { /* private fields */ }
Expand description
The core of Isaac64Rng
, used with BlockRng
.
Implementations
sourceimpl Isaac64Core
impl Isaac64Core
sourcepub fn new_from_u64(seed: u64) -> Self
👎 Deprecated since 0.6.0: use SeedableRng::seed_from_u64 instead
pub fn new_from_u64(seed: u64) -> Self
use SeedableRng::seed_from_u64 instead
Create an ISAAC-64 random number generator using an u64
as seed.
If seed == 0
this will produce the same stream of random numbers as
the reference implementation when used unseeded.
Trait Implementations
sourceimpl BlockRngCore for Isaac64Core
impl BlockRngCore for Isaac64Core
sourcefn generate(&mut self, results: &mut IsaacArray<Self::Item>)
fn generate(&mut self, results: &mut IsaacArray<Self::Item>)
Refills the output buffer, results
. See also the pseudocode desciption
of the algorithm in the Isaac64Rng
documentation.
Optimisations used (similar to the reference implementation):
- The loop is unrolled 4 times, once for every constant of mix().
- The contents of the main loop are moved to a function
rngstep
, to reduce code duplication. - We use local variables for a and b, which helps with optimisations.
- We split the main loop in two, one that operates over 0..128 and one
over 128..256. This way we can optimise out the addition and modulus
from
s[i+128 mod 256]
. - We maintain one index
i
and addm
orm2
as base (m2 for thes[i+128 mod 256]
), relying on the optimizer to turn it into pointer arithmetic. - We fill
results
backwards. The reference implementation reads values fromresults
in reverse. We read them in the normal direction, to makefill_bytes
a memcopy. To maintain compatibility we fill in reverse.
sourceimpl Clone for Isaac64Core
impl Clone for Isaac64Core
sourcefn clone(&self) -> Isaac64Core
fn clone(&self) -> Isaac64Core
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Isaac64Core
impl Debug for Isaac64Core
sourceimpl SeedableRng for Isaac64Core
impl SeedableRng for Isaac64Core
Auto Trait Implementations
impl RefUnwindSafe for Isaac64Core
impl Send for Isaac64Core
impl Sync for Isaac64Core
impl Unpin for Isaac64Core
impl UnwindSafe for Isaac64Core
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more