hash_counter_engine

Synopsis

Declared in <folly/random/hash.h>

template<
    typename Hash,
    typename State>
class hash_counter_engine;

Description

Hashes an incrementing integer to produce a pseudo‐random output.

Pros: * Keeps minimal state.

Cons: * Randomness quality depends on the hash function. * Less performant than a dedicated random engine, even than one based on the same hash function might be.

Type Aliases

Name

Description

result_type

The unsigned integer type produced by the engine.

state_type

The integer counter type advanced on each draw.

Member Functions

Name

Description

hash_counter_engine [constructor]

Constructors

operator()

Generates the next random value.

Static Member Functions

Name

Description

max

Returns the largest value the engine can produce.

min

Returns the smallest value the engine can produce.

Created with MrDocs