Class subrange_adaptor

Synopsis

#include "breeze/random/subrange_adaptor.hpp"

template< typename Engine >
class subrange_adaptor

Description

Random or pseudo-random number generator adaptor.

Adapts a random or pseudo-random number generator to emit numbers in a subrange of its original range (see the max_for_subrange() facility).

Note
Does NOT support min != 0.

Methods

subrange_adaptorConstructs a subrange adaptor from a given Engine and a new max value.
nextReturns: A new random value in the adaptor's subrange.
operator=

Source

Lines 32-60 in breeze/random/subrange_adaptor.hpp.

template< typename Engine >
class subrange_adaptor
{
public:
    //!     The same as the Engine's result type.
    // -----------------------------------------------------------------------
    typedef typename Engine::result_type
                        result_type ;

    subrange_adaptor &  operator =( subrange_adaptor const & ) = delete ;

    //!     Constructs a subrange adaptor from a given Engine and a new max
    //!     value.
    //!
    //!     \pre
    //!         new_max <= e.max()
    // -----------------------------------------------------------------------
                        subrange_adaptor( Engine & e, result_type new_max ) ;

    //!     \return
    //!         A new random value in the adaptor's subrange.
    // -----------------------------------------------------------------------
    result_type         next() ;

private:
    Engine &            m_engine ;
    result_type const   m_max    ;

} ;