Scroll to navigation

std::independent_bits_engine(3) C++ Standard Libary std::independent_bits_engine(3)

NAME

std::independent_bits_engine - std::independent_bits_engine

Synopsis

Defined in header <random> template<

class Engine, std::size_t W, (since C++11) class UIntType

> class independent_bits_engine;

independent_bits_engine is a random number engine adaptor that produces random numbers with different number of bits than that of the wrapped engine.

Template parameters

Engine - the type of the wrapped engine W - the number of bits the generated numbers should have
the type of the generated random numbers. The effect is undefined unless UIntType - the parameter is cv-unqualified and is one of unsigned short, unsigned int,
unsigned long, or unsigned long long.

Type requirements

- Engine must meet the requirements of RandomNumberEngine. - W must be greater than zero, and no greater than std::numeric_limits<UIntType>::digits.

Member types

Member type Definition result_type (C++11) UIntType

Member functions

constructor constructs the engine adaptor (C++11) (public member function) seed sets the state of the underlying engine (C++11) (public member function) base returns the underlying engine (C++11) (public member function)

Generation

operator() advances the state of the underlying engine and returns the generated (C++11) value
(public member function) discard advances the adaptor's state by a specified amount (C++11) (public member function)

Characteristics

min gets the smallest possible value in the output range (always zero). [static] (C++11) (public static member function) max gets the largest possible value in the output range (always 2w [static] (C++11) - 1).
(public static member function)

Non-member functions

operator== compares the internal states of the adaptors and underlying operator!= engines (C++11) (function) (C++11)(removed in C++20) operator<< performs stream input and output on pseudo-random number engine operator>> adaptor (C++11) (function)

Example


This section is incomplete
Reason: no example

2026.11.10 http://cppreference.com