0022923: The command 'intersect' throws an exception.
[occt.git] / src / math / math_IntegerRandom.cxx
1 //static const char* sccsid = "@(#)math_IntegerRandom.cxx       3.2 95/01/10"; // Do not delete this line. Used by sccs.
2 #include <math_IntegerRandom.ixx>
3
4 #include <math_Recipes.hxx>
5   
6  math_IntegerRandom::math_IntegerRandom(const Standard_Integer Lower, 
7                                         const Standard_Integer Upper) {
8
9    Low = Lower;
10    Up = Upper;
11    Dummy=-1;
12    Random2(Dummy);
13  }
14
15 void math_IntegerRandom::Reset() {
16  
17   Dummy=-1;
18   Random2(Dummy);
19 }
20
21 Standard_Integer math_IntegerRandom::Next() {
22
23   Standard_Real value=Random2(Dummy);
24   Standard_Integer Result=(Standard_Integer)(Standard_Real((Up-Low))*value + Low);
25   return (Result) ;
26 }
27