Close

Relief for ODA Team in Ukraine

Learn more
ODA Kernel SDK
OdRandom Class
Syntax
C++
class OdRandom;

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

OdRandom

File: OdRandom.h 

Module: API Reference 

Copyright © 2002-2022. Open Design Alliance All rights reserved.