X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9d2c040038a30947074e95b808690438a9e225b9..9104957deccc59e0e804215d5db498fabfd40d29:/src/xbt/random.cpp diff --git a/src/xbt/random.cpp b/src/xbt/random.cpp index 21003c6144..79bc21b343 100644 --- 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"); + while (value >= mt19937_gen.max() - mt19937_gen.max() % range) { + value = mt19937_gen(); + } return value % range + min; }