libkazv
Kazv::RandomInterface Class Reference

#include <random-generator.hpp>

Public Types

using DataT = unsigned int
 

Public Member Functions

template<class DeriveT >
 RandomInterface (DeriveT obj)
 Construct a RandomInterface using an implementation. More...
 
DataT operator() ()
 Generate a random number of type DataT. More...
 
template<class RangeT >
RangeT generateRange (std::size_t size)
 Generate a range containing size random elements. More...
 
template<class RangeT >
RangeT fillRange (RangeT range)
 Fill the given range. More...
 

Member Typedef Documentation

◆ DataT

using Kazv::RandomInterface::DataT = unsigned int

Constructor & Destructor Documentation

◆ RandomInterface()

template<class DeriveT >
Kazv::RandomInterface::RandomInterface ( DeriveT  obj)
inline

Construct a RandomInterface using an implementation.

Parameters
objThe random generator implementation.

The implementation obj must be of a movable type and must be such that the following call is valid, and after that v should contain a random number:

unsigned int v = obj();

Member Function Documentation

◆ fillRange()

template<class RangeT >
RangeT Kazv::RandomInterface::fillRange ( RangeT  range)
inline

Fill the given range.

Parameters
rangeThe range to fill.
Returns
A range filled with random elements. Its size will be the same as range.

◆ generateRange()

template<class RangeT >
RangeT Kazv::RandomInterface::generateRange ( std::size_t  size)
inline

Generate a range containing size random elements.

RangeT must have a constructor such that RangeT(size, ValueT()) constructs a range of size elements valued ValueT(), where ValueT is the value type of RangeT.

Parameters
sizeThe size of the range to create.
Returns
A RangeT containing size random elements.

◆ operator()()

DataT Kazv::RandomInterface::operator() ( )
inline

Generate a random number of type DataT.

Returns
A randomly generated DataT.

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