OpenVDB: RandInt< IntType, EngineType > Class Template Reference

OpenVDB 9.0.0

Public Member Functions | List of all members
RandInt< IntType, EngineType > Class Template Reference

Simple random integer generator. More...

`#include <openvdb/math/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::v9_0::math::RandInt< IntType, EngineType >

Simple random integer generator.

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

## Constructor & Destructor Documentation

## ◆ RandInt() [1/2]

RandInt | ( | const EngineType & | engine,
|  | IntType | imin,
|  | IntType | imax
| ) |  |
| inline

Initialize the generator.

Parameters

  engine | random number generator
  imin,imax | generate integers that are uniformly distributed over [imin, imax]

## ◆ RandInt() [2/2]

RandInt | ( | unsigned int | seed,
|  | IntType | imin,
|  | IntType | imax
| ) |  |
| inline

Initialize the generator.

Parameters

  seed | seed value for the random number generator
  imin,imax | generate integers that are uniformly distributed over [imin, imax]

## Member Function Documentation

## ◆ engine()

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

Return a const reference to the random number generator.

## ◆ operator()() [1/2]

IntType operator() | ( |  | ) |
| inline

Return a randomly-generated integer in the current range.

## ◆ operator()() [2/2]

IntType operator() | ( | IntType | imin,
|  | IntType | imax
| ) |  |
| inline

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

## ◆ setRange()

void setRange | ( | IntType | imin,
|  | IntType | imax
| ) |  |
| inline

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

## ◆ setSeed()

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

Set the seed value for the random number generator.