Struct RandomSequenceBuilder

Source
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, }
👎Deprecated since 0.2.0: please use the rand-unique crate instead
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
👎Deprecated since 0.2.0: please use the rand-unique crate instead

The seed for the the start index.

§seed_offset: T
👎Deprecated since 0.2.0: please use the rand-unique crate instead

The seed for the offsetting addition.

§init_base: T
👎Deprecated since 0.2.0: please use the rand-unique crate instead

A value used as an xor during initialisation for start_index = f(seed_base, init_base) to deterministically pseudo-randomise it.

§init_offset: T
👎Deprecated since 0.2.0: please use the rand-unique crate instead

A value used as an xor during initialisation for offset = f(seed_offset, init_offset) to deterministically pseudo-randomise it.

§prime: T
👎Deprecated since 0.2.0: please use the rand-unique crate instead

Should be the largest prime number that fits in type T and satisfied prime = 3 mod 4.

§intermediate_xor: T
👎Deprecated since 0.2.0: please use the rand-unique crate instead

A value that provides some noise from the xor to generate a pseudo-uniform distribution.

Implementations§

Source§

impl<T> RandomSequenceBuilder<T>
where T: QuadraticResidue,

Source

pub unsafe fn from_spec( seed_base: T, seed_offset: T, init_base: T, init_offset: T, prime: T, intermediate_xor: T, ) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

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>

Source

pub fn new(seed_base: u8, seed_offset: u8) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a specific seed pair.

Source§

impl RandomSequenceBuilder<u16>

Source

pub fn new(seed_base: u16, seed_offset: u16) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a specific seed pair.

Source§

impl RandomSequenceBuilder<u32>

Source

pub fn new(seed_base: u32, seed_offset: u32) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a specific seed pair.

Source§

impl RandomSequenceBuilder<u64>

Source

pub fn new(seed_base: u64, seed_offset: u64) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a specific seed pair.

Source§

impl RandomSequenceBuilder<usize>

Source

pub fn new(seed_base: usize, seed_offset: usize) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a specific seed pair.

Source§

impl RandomSequenceBuilder<u8>

Source

pub fn rand(rng: &mut impl RngCore) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a random seed.

Source§

impl RandomSequenceBuilder<u16>

Source

pub fn rand(rng: &mut impl RngCore) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a random seed.

Source§

impl RandomSequenceBuilder<u32>

Source

pub fn rand(rng: &mut impl RngCore) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a random seed.

Source§

impl RandomSequenceBuilder<u64>

Source

pub fn rand(rng: &mut impl RngCore) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a random seed.

Source§

impl RandomSequenceBuilder<usize>

Source

pub fn rand(rng: &mut impl RngCore) -> Self

👎Deprecated since 0.2.0: please use the rand-unique crate instead

Initialise a RandomSequenceBuilder from a random seed.

Trait Implementations§

Source§

impl<T> Clone for RandomSequenceBuilder<T>
where T: QuadraticResidue + Clone,

Source§

fn clone(&self) -> RandomSequenceBuilder<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for RandomSequenceBuilder<T>
where T: QuadraticResidue + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for RandomSequenceBuilder<T>
where T: QuadraticResidue + Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> From<RandomSequenceBuilder<T>> for RandomSequence<T>
where T: QuadraticResidue, RandomSequence<T>: Iterator<Item = T>,

Source§

fn from(value: RandomSequenceBuilder<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> IntoIterator for RandomSequenceBuilder<T>
where T: QuadraticResidue, RandomSequence<T>: Iterator<Item = T>,

Source§

fn into_iter(self) -> Self::IntoIter

Build a RandomSequence iterator from this config.

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = RandomSequence<T>

Which kind of iterator are we turning this into?
Source§

impl<T> PartialEq for RandomSequenceBuilder<T>
where T: QuadraticResidue + PartialEq,

Source§

fn eq(&self, other: &RandomSequenceBuilder<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Serialize for RandomSequenceBuilder<T>
where T: QuadraticResidue + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> Copy for RandomSequenceBuilder<T>
where T: QuadraticResidue + Copy,

Source§

impl<T> Eq for RandomSequenceBuilder<T>
where T: QuadraticResidue + Eq,

Source§

impl<T> StructuralPartialEq for RandomSequenceBuilder<T>
where T: QuadraticResidue,

Auto Trait Implementations§

§

impl<T> Freeze for RandomSequenceBuilder<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for RandomSequenceBuilder<T>
where T: RefUnwindSafe,

§

impl<T> Send for RandomSequenceBuilder<T>
where T: Send,

§

impl<T> Sync for RandomSequenceBuilder<T>
where T: Sync,

§

impl<T> Unpin for RandomSequenceBuilder<T>
where T: Unpin,

§

impl<T> UnwindSafe for RandomSequenceBuilder<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,