X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fafa947ade7d083d7fd97ba986fa72c713d789dd..92b61e41082d8e54e25b87d7d1b772f0447e4802:/src/xbt/random.cpp diff --git a/src/xbt/random.cpp b/src/xbt/random.cpp index 46f2a0fcb6..63d5353ca1 100644 --- a/src/xbt/random.cpp +++ b/src/xbt/random.cpp @@ -19,6 +19,9 @@ int uniform_int(int min, int max) unsigned long gmax = mt19937_gen.max(); unsigned long grange = gmax - gmin + 1; unsigned long range = max - min + 1; + xbt_assert( + min < max || min == max, + "The maximum value for the uniform integer distribution must be greater than or equal to the minimum value"); xbt_assert(range < grange || range == grange, "The current implementation of the uniform integer distribution does " "not allow range to be higher than mt19937's range"); unsigned long mult = grange / range;