Enum RngAlgorithm

pub enum RngAlgorithm

Identifies a particular RNG algorithm supported by proptest.

Proptest supports dynamic configuration of algorithms to allow it to continue operating with persisted regression files and to allow the configuration to be expressed in the Config struct.

Variants

XorShift

The XorShift algorithm. This was the default up through and including Proptest 0.9.0.

It is faster than ChaCha but produces lower quality randomness and has some pathological cases where it may fail to produce outputs that are random even to casual observation.

The seed must be exactly 16 bytes.

ChaCha

The ChaCha algorithm. This became the default with Proptest 0.9.1.

The seed must be exactly 32 bytes.

PassThrough

This is not an actual RNG algorithm, but instead returns data directly from its "seed".

This is useful when Proptest is being driven from some other entropy source, such as a fuzzer.

If the seed is depleted, the RNG will return 0s forever.

Note that in cases where a new RNG is to be derived from an existing one, the data is split evenly between them, regardless of how much entropy is actually needed. This means that combinators like prop_perturb and prop_flat_map can require extremely large inputs.

Recorder

This is equivalent to the ChaCha RNG, with the addition that it records the bytes used to create a value.

This is useful when Proptest is used for fuzzing, and a corpus of initial inputs need to be created. Note that in these cases, you need to use the TestRunner API directly yourself instead of using the proptest! macro, as otherwise there is no way to obtain the bytes this captures.

Trait Implementations

impl Clone for RngAlgorithm

fn clone(&self) -> RngAlgorithm

impl Copy for RngAlgorithm

impl Debug for RngAlgorithm

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

impl Default for RngAlgorithm

fn default() -> Self

impl Display for RngAlgorithm

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

impl Eq for RngAlgorithm

impl FromStr for RngAlgorithm

type Err = ();
fn from_str(s: &str) -> Result<Self, ()>

impl PartialEq for RngAlgorithm

fn eq(&self, other: &RngAlgorithm) -> bool

impl StructuralPartialEq for RngAlgorithm

Auto Trait Implementations

impl Freeze for RngAlgorithm

impl RefUnwindSafe for RngAlgorithm

impl Send for RngAlgorithm

impl Sync for RngAlgorithm

impl Unpin for RngAlgorithm

impl UnsafeUnpin for RngAlgorithm

impl UnwindSafe for RngAlgorithm

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for RngAlgorithm where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for RngAlgorithm where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for RngAlgorithm

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Read<Exclusive, BecauseExclusive> for RngAlgorithm where T: ?Sized,

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for RngAlgorithm where T: Display + ?Sized,

fn to_string(&self) -> String

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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

impl<V, T> VZip<V> for RngAlgorithm where V: MultiLane<T>,

fn vzip(self) -> V