API Reference > Other Classes > OdRandom Class
OdRandom Class
OdRandom
Syntax
C++
class OdRandom;

OdRandom.h

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));

 
Name 
Description 
 
 
 
This is the overview for the OdRandom constructor overload. 
 
Name 
Description 
 
 
 
This is the overview for the genDouble method overload. 
 
This is the overview for the generator method overload. 
 
 
 
 
 
 
 
 
 
 
 
Name 
Description 
 
= 
 
Copyright © 2002–2022. Open Design Alliance. All rights reserved.