Fixed rng::uniform to not provide the wrong result (1.0) once in every 2^32 times
This commit is contained in:
parent
3943287ad0
commit
a715dda207
1 changed files with 1 additions and 1 deletions
|
|
@ -151,7 +151,7 @@ public :
|
||||||
*/
|
*/
|
||||||
double uniform(double m = 1.0)
|
double uniform(double m = 1.0)
|
||||||
{ // random number between [0, m]
|
{ // random number between [0, m]
|
||||||
return m * double(rand()) / double(rand_max());
|
return m * double(rand()) / double(1.0+rand_max());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Reference in a new issue