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_perturbandprop_flat_mapcan require extremely large inputs.-
Recorder This is equivalent to the
ChaChaRNG, 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
TestRunnerAPI directly yourself instead of using theproptest!macro, as otherwise there is no way to obtain the bytes this captures.
Trait Implementations
impl Clone for RngAlgorithm
fn clone(&self) -> Self
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: &Self) -> bool