38912a67da8cd30464f9b6f64a402be40ef1ca61
11 /*----------------------------------------------------------------------*\
13 \*---------------------------------------------------------------------*/
15 /*--------------------------------------*\
17 \*-------------------------------------*/
19 AleaTools::AleaTools()
24 AleaTools::AleaTools(uint seed
)
29 AleaTools::~AleaTools()
34 /*--------------------------------------*\
36 \*-------------------------------------*/
38 /*----------------------*\
40 \*---------------------*/
44 * Attention : pas thread safe
46 double AleaTools::uniformeAB(double a
, double b
)
48 return a
+ uniforme01() * (b
- a
);
53 * Attention : pas thread safe
55 double AleaTools::uniforme01(void)
57 // rand in [0,RAND_MAX]
58 return rand() / (double) RAND_MAX
;
63 * Attention : pas thread safe
65 int AleaTools::uniformeAB(int a
, int b
)
67 // rand in [0,RAND_MAX]
68 double pente
= (b
-a
)/(double)RAND_MAX
;
70 return a
+(int)(pente
*rand());
74 /*----------------------------------------------------------------------*\
76 \*---------------------------------------------------------------------*/