pub struct RandomSequenceBuilder<T>where
T: QuadraticResidue,{
pub seed_base: T,
pub seed_offset: T,
pub init_base: T,
pub init_offset: T,
pub prime: T,
pub intermediate_xor: T,
}
Expand description
The configuration for RandomSequence, a random unique sequence generator.
These variables define the entire sequence and should not be modified with the exception of
seed_base
and seed_offset
during initialisation.
The builder defines the internal properties of the sequence, and serialization includes all of the properties to preserve the sequence between crate versions which may change the fixed values between minor versions.
Crate versioning will bump:
- Minor version: when the hard coded parameters are updated in favour of better ones. It is safe to serialize the RandomSequenceBuilder between minor versions.
- Major version: when the sequence generation logic fundamentally changes the sequence, meaning it would be potentially unsafe to serialize the RandomSequenceBuilder between major crate version changes.
Fields§
§seed_base: T
The seed for the the start index.
seed_offset: T
The seed for the offsetting addition.
init_base: T
A value used as an xor during initialisation for start_index = f(seed_base, init_base)
to
deterministically pseudo-randomise it.
init_offset: T
A value used as an xor during initialisation for offset = f(seed_offset, init_offset)
to
deterministically pseudo-randomise it.
prime: T
Should be the largest prime number that fits in type T
and satisfied prime = 3 mod 4
.
intermediate_xor: T
A value that provides some noise from the xor to generate a pseudo-uniform distribution.
Implementations§
Source§impl<T> RandomSequenceBuilder<T>where
T: QuadraticResidue,
impl<T> RandomSequenceBuilder<T>where
T: QuadraticResidue,
Sourcepub unsafe fn from_spec(
seed_base: T,
seed_offset: T,
init_base: T,
init_offset: T,
prime: T,
intermediate_xor: T,
) -> Self
pub unsafe fn from_spec( seed_base: T, seed_offset: T, init_base: T, init_offset: T, prime: T, intermediate_xor: T, ) -> Self
Initialise a config from stored settings. Not recommended unless you know what you’re doing, or these values have been taken from an already serialized RandomSequenceBuilder.
Prefer [RandomSequenceBuilderInit::new] instead.
Source§impl RandomSequenceBuilder<u8>
impl RandomSequenceBuilder<u8>
Sourcepub fn new(seed_base: u8, seed_offset: u8) -> Self
pub fn new(seed_base: u8, seed_offset: u8) -> Self
Initialise a RandomSequenceBuilder from a specific seed pair.
Source§impl RandomSequenceBuilder<u16>
impl RandomSequenceBuilder<u16>
Sourcepub fn new(seed_base: u16, seed_offset: u16) -> Self
pub fn new(seed_base: u16, seed_offset: u16) -> Self
Initialise a RandomSequenceBuilder from a specific seed pair.
Source§impl RandomSequenceBuilder<u32>
impl RandomSequenceBuilder<u32>
Sourcepub fn new(seed_base: u32, seed_offset: u32) -> Self
pub fn new(seed_base: u32, seed_offset: u32) -> Self
Initialise a RandomSequenceBuilder from a specific seed pair.
Source§impl RandomSequenceBuilder<u64>
impl RandomSequenceBuilder<u64>
Sourcepub fn new(seed_base: u64, seed_offset: u64) -> Self
pub fn new(seed_base: u64, seed_offset: u64) -> Self
Initialise a RandomSequenceBuilder from a specific seed pair.
Source§impl RandomSequenceBuilder<usize>
impl RandomSequenceBuilder<usize>
Sourcepub fn new(seed_base: usize, seed_offset: usize) -> Self
pub fn new(seed_base: usize, seed_offset: usize) -> Self
Initialise a RandomSequenceBuilder from a specific seed pair.
Trait Implementations§
Source§impl<T> Clone for RandomSequenceBuilder<T>where
T: QuadraticResidue + Clone,
impl<T> Clone for RandomSequenceBuilder<T>where
T: QuadraticResidue + Clone,
Source§fn clone(&self) -> RandomSequenceBuilder<T>
fn clone(&self) -> RandomSequenceBuilder<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more