about summary refs log tree commit diff stats
path: root/Source/Random.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Random.cpp')
-rw-r--r--Source/Random.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Random.cpp b/Source/Random.cpp index c921e58..d8f5eb2 100644 --- a/Source/Random.cpp +++ b/Source/Random.cpp
@@ -7,8 +7,8 @@ void Random::SetSeed(int seed) {
7 s_seed = seed; 7 s_seed = seed;
8} 8}
9 9
10// Returns a random integer in [min, max]
10int Random::RandInt(int min, int max) { 11int Random::RandInt(int min, int max) {
11 s_seed = (214013 * s_seed + 2531011) % 2147483648; 12 s_seed = (214013 * s_seed + 2531011) % 2147483648;
12 if (min == max) return min; 13 return (s_seed % (max - min + 1)) + min;
13 return (s_seed % (max - (min - 1))) + min;
14} 14}