blob: 9c8c908c3cf28902954b4bdea557ecbcefa886e0 (
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
27
|
//static const char* sccsid = "@(#)math_IntegerRandom.cxx 3.2 95/01/10"; // Do not delete this line. Used by sccs.
#include <math_IntegerRandom.ixx>
#include <math_Recipes.hxx>
math_IntegerRandom::math_IntegerRandom(const Standard_Integer Lower,
const Standard_Integer Upper) {
Low = Lower;
Up = Upper;
Dummy=-1;
Random2(Dummy);
}
void math_IntegerRandom::Reset() {
Dummy=-1;
Random2(Dummy);
}
Standard_Integer math_IntegerRandom::Next() {
Standard_Real value=Random2(Dummy);
Standard_Integer Result=(Standard_Integer)(Standard_Real((Up-Low))*value + Low);
return (Result) ;
}
|