Count Engine Adaptor#

count_engine_adaptor is a random number engine adaptor that counts how many times random 32 bits were taken from the engine during the generate call.

Description#

This adaptor allows users to query the number of random numbers generated by an engine during the generate call. Especially it’s especially useful for distributions based on acceptance-rejection algorithms, such as beta, gamma.

API#

Syntax#

namespace oneapi::mkl::rng::device {
 template <typename Engine>
 class count_engine_adaptor {
 public:
     static constexpr std::int32_t vec_size = Engine::vec_size;
     // ctors
     explicit count_engine_adaptor(const Engine& engine);
     explicit count_engine_adaptor(Engine&& engine);
     template <typename... Params>
     count_engine_adaptor(Params... params);
     // getters
     std::int64_t get_count() const;
     const Engine& base() const;
 };
}

Include Files#

  • oneapi/mkl/rng/device.hpp

Template Parameters#

typename Engine

Type of the provided random engine

Constructors Input Parameters#

Name

Type

Description

engine

const Engine& or Engine&&

Constructs the adaptor over engine by constant lvalue reference or rvalue reference.

params

Params...

Constructs the adaptor generating an engine inside. params is a pack of input parameters to create an engine.

Getters#

std::size_t get_count() const

This method returns the count of random numbers generated by generate.

const Engine& base() const

Returns the underlying random engine.