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

An efficient random bit generator for performance&hyphen;sensitive use cases&period;

== Synopsis

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

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

== Description

`absl&colon;&colon;InsecureBitGen` is recommended only for performance&hyphen;sensitive use cases where `absl&colon;&colon;BitGen` is not satisfactory when compute&hyphen;bounded by bit generation costs&period;

Example&colon;

&sol;&sol; Create an absl&colon;&colon;InsecureBitGen absl&colon;&colon;InsecureBitGen gen&semi; for (size&lowbar;t i &equals; 0&semi; i &lt; 1000000&semi; i&plus;&plus;) &lcub;

&sol;&sol; Generate a bunch of random values from some complex distribution auto my&lowbar;rnd &equals; some&lowbar;distribution(gen, 1, 1000)&semi; &rcub;

Like `absl&colon;&colon;BitGen`, `absl&colon;&colon;InsecureBitGen` is seeded by default with non&hyphen;deterministic data to produce different sequences of random values across different instances, including different binary invocations&period; (This behavior is different than the standard library bit generators, which use golden values as their seeds&period;)

`absl&colon;&colon;InsecureBitGen` may be constructed with an optional seed sequence type, conforming to &lsqb;rand&period;req&period;seed&lowbar;seq&rsqb;, which will be mixed with additional non&hyphen;deterministic data, as detailed in the `absl&colon;&colon;BitGen` comment&period;

`absl&colon;&colon;InsecureBitGen` meets the requirements of the Uniform Random Bit Generator (URBG) concept as per the C&plus;&plus;17 standard &lsqb;rand&period;req&period;urng&rsqb;though its implementation differs slightly with &lsqb;rand&period;req&period;eng&rsqb;&period; Like its standard library equivalents (e&period;g&period; `std&colon;&colon;mersenne&lowbar;twister&lowbar;engine`) `absl&colon;&colon;InsecureBitGen` is not cryptographically secure&period;

Prefer `absl&colon;&colon;BitGen` over `absl&colon;&colon;InsecureBitGen` as the general type is often fast enough for the vast majority of applications&period; However, it is reasonable to use `absl&colon;&colon;InsecureBitGen` in tests or when using a URBG in small isolated tasks such as in `std&colon;&colon;shuffle`&period;

This type is thread&hyphen;compatible, but not thread&hyphen;safe&period;

== Type Aliases

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


== Using Declarations

[cols="1,4"]
|===
| Name| Description
| xref:absl/InsecureBitGen/InsecureBitGen.adoc[`InsecureBitGen`] 
| Inherits the base constructors&period;
| xref:absl/InsecureBitGen/discard.adoc[`discard`] 
| Advances the internal state of this bit generator&period;
| xref:absl/InsecureBitGen/max.adoc[`max`] 
| Returns the largest possible value from this bit generator&period;
| xref:absl/InsecureBitGen/min.adoc[`min`] 
| Returns the smallest possible value from this bit generator&period;
| xref:absl/InsecureBitGen/operator!=.adoc[`operator!&equals;`] 
| Compares two bit generators for inequality&period;
| xref:absl/InsecureBitGen/operator().adoc[`operator()`] 
| Invokes the URBG, returning a generated value&period;
| xref:absl/InsecureBitGen/operator=.adoc[`operator&equals;`] 
| Inherits the base assignment operators&period;
| xref:absl/InsecureBitGen/operator==.adoc[`operator&equals;&equals;`] 
| Compares two bit generators for equality&period;
|===



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