pub struct RngWrapper<T>(_);
Expand description

A new-style Rng, wrapped for backward compatibility.

This object implements both the current (0.6.2) version of RngCore, as well as the version from 0.5.1 that the dalek-crypto functions expect.

To get an RngWrapper, use the RngCompatExt extension trait:

use tor_llcrypto::util::rand_compat::RngCompatExt;

let mut wrapped_rng = rand::thread_rng().rng_compat();

Trait Implementations

Converts to this type from the input type.

Return the next random u32. Read more

Return the next random u64. Read more

Fill dest with random data. Read more

Fill dest entirely with random data. Read more

Return the next random u32. Read more

Return the next random u64. Read more

Fill dest with random data. Read more

Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Generate a random BigUint of the given bit size.

Generate a random BigInt of the given bit size.

Generate a random BigUint less than the given bound. Fails when the bound is zero. Read more

Generate a random BigUint within the given range. The lower bound is inclusive; the upper bound is exclusive. Fails when the upper bound is not greater than the lower bound. Read more

Generate a random BigInt within the given range. The lower bound is inclusive; the upper bound is exclusive. Fails when the upper bound is not greater than the lower bound. Read more

Generate a random prime number with as many bits as given.

Return a random value supporting the Standard distribution. Read more

Generate a random value in the range [low, high), i.e. inclusive of low and exclusive of high. Read more

Sample a new value, using the given distribution. Read more

Create an iterator that generates values using the given distribution. Read more

Fill dest entirely with random bytes (uniform value distribution), where dest is any type supporting AsByteSliceMut, namely slices and arrays over primitive integer types (i8, i16, u32, etc.). Read more

Fill dest entirely with random bytes (uniform value distribution), where dest is any type supporting AsByteSliceMut, namely slices and arrays over primitive integer types (i8, i16, u32, etc.). Read more

Return a bool with a probability p of being true. Read more

Return a bool with a probability of numerator/denominator of being true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of returning true. If numerator == denominator, then the returned value is guaranteed to be true. If numerator == 0, then the returned value is guaranteed to be false. Read more

Return a random value supporting the Standard distribution. Read more

Generate a random value in the given range. Read more

Sample a new value, using the given distribution. Read more

Create an iterator that generates values using the given distribution. Read more

Fill any type implementing Fill with random data Read more

Fill any type implementing Fill with random data Read more

Return a bool with a probability p of being true. Read more

Return a bool with a probability of numerator/denominator of being true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of returning true. If numerator == denominator, then the returned value is guaranteed to be true. If numerator == 0, then the returned value is guaranteed to be false. Read more

Wrapper type returned by this trait.

Return a version of this Rng that can be used with older versions of the rand_core and rand libraries, as well as the current version. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.