A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'pikachuyann/simgrid-xbt_random'
[simgrid.git]
/
src
/
xbt
/
random.cpp
diff --git
a/src/xbt/random.cpp
b/src/xbt/random.cpp
index
21003c6
..
79bc21b
100644
(file)
--- a/
src/xbt/random.cpp
+++ b/
src/xbt/random.cpp
@@
-42,6
+42,9
@@
int uniform_int(int min, int max)
xbt_assert(
min <= max,
"The maximum value for the uniform integer distribution must be greater than or equal to the minimum value");
xbt_assert(
min <= max,
"The maximum value for the uniform integer distribution must be greater than or equal to the minimum value");
+ while (value >= mt19937_gen.max() - mt19937_gen.max() % range) {
+ value = mt19937_gen();
+ }
return value % range + min;
}
return value % range + min;
}