[#RandomMixin-01]
= RandomMixin
:mrdocs:

Mixin class that provides helper randomness functions&period;

== Synopsis

Declared in `&lt;random&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
class RandomMixin;
----

== Description

Intended to be used through CRTP&colon; https&colon;&sol;&sol;en&period;cppreference&period;com&sol;w&sol;cpp&sol;language&sol;crtp&period; An RNG class FunkyRNG would derive publicly from RandomMixin&lt;FunkyRNG&gt;&period; This permits RandomMixin from accessing the derived class&apos;s rand64() function, while also allowing the derived class to provide more&period;

The derived class must satisfy the RandomNumberGenerator concept&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:RandomMixin-01/result_type.adoc[`result&lowbar;type`] 
| Result type of the generator, for the UniformRandomBitGenerator concept&period;
|===


== 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&equals;`] 
| Assignment operators
| xref:RandomMixin-01/fillrand.adoc[`fillrand`] 
| Fill a span with random bytes&period;
| xref:RandomMixin-01/operator_call.adoc[`operator()`] 
| Generate the next random value, for the UniformRandomBitGenerator concept&period;
| xref:RandomMixin-01/rand.adoc[`rand`] 
| Generate a random integer in its entire (non&hyphen;negative) range&period;
| xref:RandomMixin-01/rand256.adoc[`rand256`] 
| generate a random uint256&period;
| xref:RandomMixin-01/rand32.adoc[`rand32`] 
| Generate a random 32&hyphen;bit integer&period;
| xref:RandomMixin-01/rand_exp_duration.adoc[`rand&lowbar;exp&lowbar;duration`] 
| Return a duration sampled from an exponential distribution (https&colon;&sol;&sol;en&period;wikipedia&period;org&sol;wiki&sol;Exponential&lowbar;distribution)&period; Successive events whose intervals are distributed according to this form a memoryless Poisson process&period; This should be used for repeated network events (e&period;g&period; sending a certain type of message) to minimize leaking information to observers&period;
| xref:RandomMixin-01/rand_uniform_delay.adoc[`rand&lowbar;uniform&lowbar;delay`] 
| Return the time point advanced by a uniform random duration&period;
| xref:RandomMixin-01/rand_uniform_duration.adoc[`rand&lowbar;uniform&lowbar;duration`] 
| Generate a uniform random duration in the range from 0 (inclusive) to range (exclusive)&period;
| xref:RandomMixin-01/randbits-01.adoc[`randbits`] 
| `randbits` overloads
| xref:RandomMixin-01/randbool.adoc[`randbool`] 
| Generate a random boolean&period;
| 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&period;
| xref:RandomMixin-01/min.adoc[`min`] 
| Smallest value the generator can produce&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:RandomMixin-01/FlushCache.adoc[`FlushCache`] 
| Discard any random bits buffered from a previous rand64() call&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:FastRandomContext.adoc[`FastRandomContext`] 
| Fast randomness source&period; This is seeded once with secure random data, but is completely deterministic and does not gather more entropy after that&period;
| xref:InsecureRandomContext.adoc[`InsecureRandomContext`] 
| xoroshiro128&plus;&plus; PRNG&period; Extremely fast, not appropriate for cryptographic purposes&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
