[#RandomMixin-01] = RandomMixin :mrdocs: Mixin class that provides helper randomness functions. == Synopsis Declared in `<random.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> class RandomMixin; ---- == Description Intended to be used through CRTP: https://en.cppreference.com/w/cpp/language/crtp. An RNG class FunkyRNG would derive publicly from RandomMixin<FunkyRNG>. This permits RandomMixin from accessing the derived class's rand64() function, while also allowing the derived class to provide more. The derived class must satisfy the RandomNumberGenerator concept. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:RandomMixin-01/result_type.adoc[`result_type`] | Result type of the generator, for the UniformRandomBitGenerator concept. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:RandomMixin-01/2constructor-01.adoc[`RandomMixin`] [.small]#[constructor]# | Constructors | xref:RandomMixin-01/operator_assign-09.adoc[`operator=`] | Assignment operators | xref:RandomMixin-01/fillrand.adoc[`fillrand`] | Fill a span with random bytes. | xref:RandomMixin-01/operator_call.adoc[`operator()`] | Generate the next random value, for the UniformRandomBitGenerator concept. | xref:RandomMixin-01/rand.adoc[`rand`] | Generate a random integer in its entire (non‐negative) range. | xref:RandomMixin-01/rand256.adoc[`rand256`] | generate a random uint256. | xref:RandomMixin-01/rand32.adoc[`rand32`] | Generate a random 32‐bit integer. | xref:RandomMixin-01/rand_exp_duration.adoc[`rand_exp_duration`] | Return a duration sampled from an exponential distribution (https://en.wikipedia.org/wiki/Exponential_distribution). Successive events whose intervals are distributed according to this form a memoryless Poisson process. This should be used for repeated network events (e.g. sending a certain type of message) to minimize leaking information to observers. | xref:RandomMixin-01/rand_uniform_delay.adoc[`rand_uniform_delay`] | Return the time point advanced by a uniform random duration. | xref:RandomMixin-01/rand_uniform_duration.adoc[`rand_uniform_duration`] | Generate a uniform random duration in the range from 0 (inclusive) to range (exclusive). | xref:RandomMixin-01/randbits-01.adoc[`randbits`] | `randbits` overloads | xref:RandomMixin-01/randbool.adoc[`randbool`] | Generate a random boolean. | xref:RandomMixin-01/randbytes-0f.adoc[`randbytes`] | `randbytes` overloads | xref:RandomMixin-01/randrange-0a.adoc[`randrange`] | `randrange` overloads |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:RandomMixin-01/max.adoc[`max`] | Largest value the generator can produce. | xref:RandomMixin-01/min.adoc[`min`] | Smallest value the generator can produce. |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:RandomMixin-01/FlushCache.adoc[`FlushCache`] | Discard any random bits buffered from a previous rand64() call. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:FastRandomContext.adoc[`FastRandomContext`] | Fast randomness source. This is seeded once with secure random data, but is completely deterministic and does not gather more entropy after that. | xref:InsecureRandomContext.adoc[`InsecureRandomContext`] | xoroshiro128++ PRNG. Extremely fast, not appropriate for cryptographic purposes. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#