[#absl-BitGenRef]
= xref:absl.adoc[absl]::BitGenRef
:relfileprefix: ../
:mrdocs:

A type&hyphen;erasing, non&hyphen;owning reference to any uniform random bit generator&period;

== Synopsis

Declared in `&lt;absl&sol;random&sol;bit&lowbar;gen&lowbar;ref&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class BitGenRef;
----

== Description

`absl&colon;&colon;BitGenRef` provides a generator&hyphen;agnostic non&hyphen;owning &quot;reference&quot; interface for use in place of any specific uniform random bit generator (URBG)&period; This class may be used for both Abseil (e&period;g&period; `absl&colon;&colon;BitGen`, `absl&colon;&colon;InsecureBitGen`) and Standard library (e&period;g `std&colon;&colon;mt19937`, `std&colon;&colon;minstd&lowbar;rand`) bit generators&period;

Like other reference classes, `absl&colon;&colon;BitGenRef` does not own the underlying bit generator, and the underlying instance must outlive the `absl&colon;&colon;BitGenRef`&period;

`absl&colon;&colon;BitGenRef` is particularly useful when used with an `absl&colon;&colon;MockingBitGen` to test specific paths in functions which use random values&period;

Example&colon; void TakesBitGenRef(absl&colon;&colon;BitGenRef gen) &lcub; int x &equals; absl&colon;&colon;Uniform&lt;int&gt;(gen, 0, 1000)&semi; &rcub;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:absl/BitGenRef/result_type.adoc[`result&lowbar;type`] 
| The type of the values produced by the referenced bit generator&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/BitGenRef/2constructor-0f.adoc[`BitGenRef`]         [.small]#[constructor]#
| Constructors
| xref:absl/BitGenRef/operator_assign-04.adoc[`operator&equals;`] 
| Assignment operators
| xref:absl/BitGenRef/operator_call.adoc[`operator()`] 
| Invokes the referenced bit generator, returning a generated value&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/BitGenRef/max.adoc[`max`] 
| Returns the largest possible value from this bit generator&period;
| xref:absl/BitGenRef/min.adoc[`min`] 
| Returns the smallest possible value from this bit generator&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `absl::RandomMockingAccess`
| 
|===


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