CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdRandom Class Reference

#include <OdRandom.h>

Public Member Functions

 OdRandom (OdRandomGen *newGenerator=NULL)
 
 ~OdRandom ()
 
 OdRandom (const OdRandom &iSrc)
 
void operator= (const OdRandom &iSrc)
 
OdRandomGengenerator ()
 
const OdRandomGengenerator () const
 
OdUInt64 genUInt64 (OdUInt64 low, OdUInt64 high)
 
OdInt64 genInt64 (OdInt64 low, OdInt64 high)
 
unsigned genUInt (unsigned low, unsigned high)
 
int genInt (int low, int high)
 
bool genBool ()
 
double genDouble ()
 
double genDouble (double low, double high)
 
template<class T, class A>
const T & randomOf (const OdArray< T, A > &iArray)
 

Detailed Description

<group Other_Classes> Random number generator with support for uniform distributions.

A few important facts:

  1. The state is stored internally (no global state like in rand).
  2. The generated integer numbers are exactly the same on every platform on every run.
  3. Ideally, the same should apply to real numbers: they should be same on every platform on every run. Even if they are different, the deviation should be negligible (~ DBL_EPSILON) relative to distribution range.

Sample usage: OdRandom rnd; for (int i = 0; i < 1000; i++) samples.push_back(rnd.genDouble(0, OdaPI));

Definition at line 65 of file OdRandom.h.

Constructor & Destructor Documentation

◆ OdRandom() [1/2]

OdRandom::OdRandom ( OdRandomGen * newGenerator = NULL)
explicit

◆ ~OdRandom()

OdRandom::~OdRandom ( )

◆ OdRandom() [2/2]

OdRandom::OdRandom ( const OdRandom & iSrc)

Member Function Documentation

◆ genBool()

bool OdRandom::genBool ( )

◆ genDouble() [1/2]

double OdRandom::genDouble ( )

◆ genDouble() [2/2]

double OdRandom::genDouble ( double low,
double high )

◆ generator() [1/2]

OdRandomGen & OdRandom::generator ( )

◆ generator() [2/2]

const OdRandomGen & OdRandom::generator ( ) const

◆ genInt()

int OdRandom::genInt ( int low,
int high )

◆ genInt64()

OdInt64 OdRandom::genInt64 ( OdInt64 low,
OdInt64 high )

◆ genUInt()

unsigned OdRandom::genUInt ( unsigned low,
unsigned high )

◆ genUInt64()

OdUInt64 OdRandom::genUInt64 ( OdUInt64 low,
OdUInt64 high )

◆ operator=()

void OdRandom::operator= ( const OdRandom & iSrc)

◆ randomOf()

template<class T, class A>
const T & OdRandom::randomOf ( const OdArray< T, A > & iArray)
inline

Definition at line 90 of file OdRandom.h.


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