libstdc++: std::discard_block_engine< _RandomNumberEngine, __p, __r > Class Template Reference

libstdc++

std::discard_block_engine< _RandomNumberEngine, __p, __r > Class Template Reference
Numerics » Random Number Generation » Random Number Generators

`#include <random>`

## Public Types
template<typename _Sseq>
using | _If_seed_seq
typedef _RandomNumberEngine::result_type | result_type

## Public Member Functions
| discard_block_engine ()
| discard_block_engine (_RandomNumberEngine &&__rng)
template<typename _Sseq, typename = _If_seed_seq<_Sseq>>
| discard_block_engine (_Sseq &__q)
| discard_block_engine (const _RandomNumberEngine &__rng)
| discard_block_engine (result_type __s)
const _RandomNumberEngine & | base () const noexcept
void | discard (unsigned long long __z)
result_type | operator() ()
void | seed ()
template<typename _Sseq>
_If_seed_seq< _Sseq > | seed (_Sseq &__q)
void | seed (result_type __s)

## Static Public Member Functions
static constexpr result_type | max ()
static constexpr result_type | min ()

## Static Public Attributes
static constexpr size_t | block_size
static constexpr size_t | used_block

## Friends
template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits>
std::basic_ostream< _CharT, _Traits > & | operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > &__x)
bool | operator== (const discard_block_engine &__lhs, const discard_block_engine &__rhs)
template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits>
std::basic_istream< _CharT, _Traits > & | operator>> (std::basic_istream< _CharT, _Traits > &__is, std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > &__x)

## Detailed Description

template<typename _RandomNumberEngine, size_t __p, size_t __r>
class std::discard_block_engine< _RandomNumberEngine, __p, __r >

Produces random numbers from some base engine by discarding blocks of data.

Precondition

Since
  C++11

Definition at line 1347 of file random.h.

## Member Typedef Documentation

## ◆ _If_seed_seq

template<typename _RandomNumberEngine, size_t __p, size_t __r>
template<typename _Sseq>

using std::discard_block_engine< _RandomNumberEngine, __p, __r >::_If_seed_seq

Definition at line 1357 of file random.h.

## ◆ result_type

template<typename _RandomNumberEngine, size_t __p, size_t __r>

typedef _RandomNumberEngine::result_type std::discard_block_engine< _RandomNumberEngine, __p, __r >::result_type

The type of the generated random value.

Definition at line 1354 of file random.h.

## Constructor & Destructor Documentation

## ◆ discard_block_engine() [1/5]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard_block_engine | ( |  | ) |
| inline

Constructs a default discard_block_engine engine.

The underlying engine is default constructed as well.

Definition at line 1369 of file random.h.

## ◆ discard_block_engine() [2/5]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard_block_engine | ( | const _RandomNumberEngine & | __rng | ) |
| inlineexplicit

Copy constructs a discard_block_engine engine.

Copies an existing base class random number generator.

Parameters

  __rng | An existing (base class) engine object.

Definition at line 1379 of file random.h.

## ◆ discard_block_engine() [3/5]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard_block_engine | ( | _RandomNumberEngine && | __rng | ) |
| inlineexplicit

Move constructs a discard_block_engine engine.

Copies an existing base class random number generator.

Parameters

  __rng | An existing (base class) engine object.

Definition at line 1389 of file random.h.

## ◆ discard_block_engine() [4/5]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard_block_engine | ( | result_type | __s | ) |
| inlineexplicit

Seed constructs a discard_block_engine engine.

Constructs the underlying generator engine seeded with `__s`.

Parameters

  __s | A seed value for the base class engine.

Definition at line 1399 of file random.h.

## ◆ discard_block_engine() [5/5]

template<typename _RandomNumberEngine, size_t __p, size_t __r>
template<typename _Sseq, typename = _If_seed_seq<_Sseq>>

std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard_block_engine | ( | _Sseq & | __q | ) |
| inlineexplicit

Generator construct a discard_block_engine engine.

Parameters

  __q | A seed sequence.

Definition at line 1409 of file random.h.

## Member Function Documentation

## ◆ base()

template<typename _RandomNumberEngine, size_t __p, size_t __r>

const _RandomNumberEngine & std::discard_block_engine< _RandomNumberEngine, __p, __r >::base | ( |  | ) | const
| inlinenoexcept

Gets a const reference to the underlying generator engine object.

Definition at line 1453 of file random.h.

## ◆ discard()

template<typename _RandomNumberEngine, size_t __p, size_t __r>

void std::discard_block_engine< _RandomNumberEngine, __p, __r >::discard | ( | unsigned long long | __z | ) |
| inline

Discard a sequence of random numbers.

Definition at line 1474 of file random.h.

## ◆ max()

template<typename _RandomNumberEngine, size_t __p, size_t __r>

constexpr result_type std::discard_block_engine< _RandomNumberEngine, __p, __r >::max | ( |  | ) |
| inlinestaticconstexpr

Gets the maximum value in the generated random number range.

Definition at line 1467 of file random.h.

## ◆ min()

template<typename _RandomNumberEngine, size_t __p, size_t __r>

constexpr result_type std::discard_block_engine< _RandomNumberEngine, __p, __r >::min | ( |  | ) |
| inlinestaticconstexpr

Gets the minimum value in the generated random number range.

Definition at line 1460 of file random.h.

## ◆ operator()()

template<typename _RandomNumberEngine, size_t __p, size_t __r>

discard_block_engine< _RandomNumberEngine, __p, __r >::result_type std::discard_block_engine< _RandomNumberEngine, __p, __r >::operator() | ( |  | ) |

Gets the next value in the generated random number sequence.

Definition at line 689 of file bits/random.tcc.

## ◆ seed() [1/3]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

void std::discard_block_engine< _RandomNumberEngine, __p, __r >::seed | ( |  | ) |
| inline

Reseeds the discard_block_engine object with the default seed for the underlying base class generator engine.

Definition at line 1418 of file random.h.

## ◆ seed() [2/3]

template<typename _RandomNumberEngine, size_t __p, size_t __r>
template<typename _Sseq>

_If_seed_seq< _Sseq > std::discard_block_engine< _RandomNumberEngine, __p, __r >::seed | ( | _Sseq & | __q | ) |
| inline

Reseeds the discard_block_engine object with the given seed sequence.

Parameters

  __q | A seed generator function.

Definition at line 1442 of file random.h.

## ◆ seed() [3/3]

template<typename _RandomNumberEngine, size_t __p, size_t __r>

void std::discard_block_engine< _RandomNumberEngine, __p, __r >::seed | ( | result_type | __s | ) |
| inline

Reseeds the discard_block_engine object with the default seed for the underlying base class generator engine.

Definition at line 1429 of file random.h.

## Friends And Related Symbol Documentation

## ◆ operator<<

template<typename _RandomNumberEngine, size_t __p, size_t __r>
template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits>

std::basic_ostream< _CharT, _Traits > & operator<< | ( | std::basic_ostream< _CharT, _Traits > & | __os,
|  | const std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > & | __x )
| friend

Inserts the current state of a discard_block_engine random number generator engine `__x` into the output stream `__os`.

Parameters

  __os | An output stream.
  __x | A discard_block_engine random number generator engine.

Returns
  The output stream with the state of `__x` inserted or in an error state.

## ◆ operator==

template<typename _RandomNumberEngine, size_t __p, size_t __r>

bool operator== | ( | const discard_block_engine< _RandomNumberEngine, __p, __r > & | __lhs,
|  | const discard_block_engine< _RandomNumberEngine, __p, __r > & | __rhs )
| friend

Compares two discard_block_engine random number generator objects of the same type for equality.

Parameters

  __lhs | A discard_block_engine random number generator object.
  __rhs | Another discard_block_engine random number generator object.

Returns
  true if the infinite sequences of generated values would be equal, false otherwise.

Definition at line 1498 of file random.h.

## ◆ operator>>

template<typename _RandomNumberEngine, size_t __p, size_t __r>
template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits>

std::basic_istream< _CharT, _Traits > & operator>> | ( | std::basic_istream< _CharT, _Traits > & | __is,
|  | std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > & | __x )
| friend

Extracts the current state of a % subtract_with_carry_engine random number generator engine `__x` from the input stream `__is`.

Parameters

  __is | An input stream.
  __x | A discard_block_engine random number generator engine.

Returns
  The input stream with the state of `__x` extracted or in an error state.

## Member Data Documentation

## ◆ block_size

template<typename _RandomNumberEngine, size_t __p, size_t __r>

size_t std::discard_block_engine< _RandomNumberEngine, __p, __r >::block_size
| staticconstexpr

Definition at line 1361 of file random.h.

## ◆ used_block

template<typename _RandomNumberEngine, size_t __p, size_t __r>

size_t std::discard_block_engine< _RandomNumberEngine, __p, __r >::used_block
| staticconstexpr

Definition at line 1362 of file random.h.

The documentation for this class was generated from the following files:

- random.h
- bits/random.tcc