summaryrefslogtreecommitdiff
path: root/src/math/math_RealRandom.cxx
blob: f0e816ba5799ae71e079dccf2e61ab2fea624d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//static const char* sccsid = "@(#)math_RealRandom.cxx	3.2 95/01/10"; // Do not delete this line. Used by sccs.
#include <math_RealRandom.ixx>
#include <math_Recipes.hxx>

math_RealRandom::math_RealRandom(const Standard_Real Lower,
				 const Standard_Real Upper) {

  Low = Lower;
  Up = Upper;
  Dummy = -1;
  Random2(Dummy);
}

void math_RealRandom::Reset() {

  Dummy = -1;
  Random2(Dummy);
}

Standard_Real math_RealRandom::Next() {
  
  Standard_Real value = Random2(Dummy);
  Standard_Real Result = (Up - Low)*value + Low;
  return Result;  

}