OpenVDB  9.0.1
Public Types | Public Member Functions | List of all members
Rand01< FloatType, EngineType > Class Template Reference

Simple generator of random numbers over the range [0, 1) More...

#include <openvdb/math/Math.h>

Public Types

using ValueType = FloatType
 

Public Member Functions

 Rand01 (const EngineType &engine)
 Initialize the generator. More...
 
 Rand01 (unsigned int seed)
 Initialize the generator. 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...
 
FloatType operator() ()
 Return a uniformly distributed random number in the range [0, 1). More...
 

Detailed Description

template<typename FloatType = double, typename EngineType = std::mt19937>
class openvdb::v9_0::math::Rand01< FloatType, EngineType >

Simple generator of random numbers over the range [0, 1)

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

Member Typedef Documentation

using ValueType = FloatType

Constructor & Destructor Documentation

Rand01 ( const EngineType &  engine)
inline

Initialize the generator.

Parameters
enginerandom number generator
Rand01 ( unsigned int  seed)
inline

Initialize the generator.

Parameters
seedseed value for the random number generator

Member Function Documentation

const EngineType& engine ( ) const
inline

Return a const reference to the random number generator.

FloatType operator() ( )
inline

Return a uniformly distributed random number in the range [0, 1).

void setSeed ( unsigned int  seed)
inline

Set the seed value for the random number generator.