HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType > Class Template Reference

Simple random integer generator. More...

#include <Math.h>

Public Member Functions

 RandInt (const EngineType &engine, IntType imin, IntType imax)
 Initialize the generator. More...
 
 RandInt (unsigned int seed, IntType imin, IntType imax)
 Initialize the generator. More...
 
void setRange (IntType imin, IntType imax)
 Change the range over which integers are distributed to [imin, imax]. More...
 
void setSeed (unsigned int seed)
 Set the seed value for the random number generator. More...
 
const EngineType & engine () const
 Return a const reference to the random number generator. More...
 
IntType operator() ()
 Return a randomly-generated integer in the current range. More...
 
IntType operator() (IntType imin, IntType imax)
 Return a randomly-generated integer in the new range [imin, imax], without changing the current range. More...
 

Detailed Description

template<typename IntType = int, typename EngineType = std::mt19937>
class openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >

Simple random integer generator.

Thread-safe as long as each thread has its own RandInt instance

Definition at line 171 of file Math.h.

Constructor & Destructor Documentation

template<typename IntType = int, typename EngineType = std::mt19937>
openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::RandInt ( const EngineType &  engine,
IntType  imin,
IntType  imax 
)
inline

Initialize the generator.

Parameters
enginerandom number generator
imin,imaxgenerate integers that are uniformly distributed over [imin, imax]

Definition at line 182 of file Math.h.

template<typename IntType = int, typename EngineType = std::mt19937>
openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::RandInt ( unsigned int  seed,
IntType  imin,
IntType  imax 
)
inline

Initialize the generator.

Parameters
seedseed value for the random number generator
imin,imaxgenerate integers that are uniformly distributed over [imin, imax]

Definition at line 190 of file Math.h.

Member Function Documentation

template<typename IntType = int, typename EngineType = std::mt19937>
const EngineType& openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::engine ( ) const
inline

Return a const reference to the random number generator.

Definition at line 208 of file Math.h.

template<typename IntType = int, typename EngineType = std::mt19937>
IntType openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::operator() ( )
inline

Return a randomly-generated integer in the current range.

Definition at line 211 of file Math.h.

template<typename IntType = int, typename EngineType = std::mt19937>
IntType openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::operator() ( IntType  imin,
IntType  imax 
)
inline

Return a randomly-generated integer in the new range [imin, imax], without changing the current range.

Definition at line 215 of file Math.h.

template<typename IntType = int, typename EngineType = std::mt19937>
void openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::setRange ( IntType  imin,
IntType  imax 
)
inline

Change the range over which integers are distributed to [imin, imax].

Definition at line 196 of file Math.h.

template<typename IntType = int, typename EngineType = std::mt19937>
void openvdb::OPENVDB_VERSION_NAME::math::RandInt< IntType, EngineType >::setSeed ( unsigned int  seed)
inline

Set the seed value for the random number generator.

Definition at line 202 of file Math.h.


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