OpenVDB 13.0.0

Loading...
Searching...
No Matches
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.
| Rand01 (unsigned int seed)
| Initialize the generator.
void | setSeed (unsigned int seed)
| Set the seed value for the random number generator.
const EngineType & | engine () const
| Return a const reference to the random number generator.
FloatType | operator() ()
| Return a uniformly distributed random number in the range [0, 1).

## Detailed Description

template<typename FloatType = double, typename EngineType = std::mt19937>
class openvdb::v13_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

## ◆ ValueType

template<typename FloatType = double, typename EngineType = std::mt19937>

using ValueType = FloatType

## Constructor & Destructor Documentation

## ◆ Rand01() [1/2]

template<typename FloatType = double, typename EngineType = std::mt19937>

Rand01 | ( | const EngineType & | engine | ) |
| inline

Initialize the generator.

Parameters

  engine | random number generator

## ◆ Rand01() [2/2]

template<typename FloatType = double, typename EngineType = std::mt19937>

Rand01 | ( | unsigned int | seed | ) |
| inline

Initialize the generator.

Parameters

  seed | seed value for the random number generator

## Member Function Documentation

## ◆ engine()

template<typename FloatType = double, typename EngineType = std::mt19937>

const EngineType & engine | ( |  | ) | const
| inline

Return a const reference to the random number generator.

## ◆ operator()()

template<typename FloatType = double, typename EngineType = std::mt19937>

FloatType operator() | ( |  | ) |
| inline

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

## ◆ setSeed()

template<typename FloatType = double, typename EngineType = std::mt19937>

void setSeed | ( | unsigned int | seed | ) |
| inline

Set the seed value for the random number generator.