diff options
| author | jbzdarkid <jbzdarkid@gmail.com> | 2018-11-05 10:06:37 -0800 |
|---|---|---|
| committer | jbzdarkid <jbzdarkid@gmail.com> | 2018-11-05 10:06:37 -0800 |
| commit | 669717268201197412c69df36e65883b0af6fac8 (patch) | |
| tree | 6345c3acd1ca42bbd31c3702e649a09512e5aed6 /Source/Random.cpp | |
| parent | a828620c6447e8c51f6e9d1767eabe0fc5ade0a0 (diff) | |
| download | witness-tutorializer-669717268201197412c69df36e65883b0af6fac8.tar.gz witness-tutorializer-669717268201197412c69df36e65883b0af6fac8.tar.bz2 witness-tutorializer-669717268201197412c69df36e65883b0af6fac8.zip | |
Tests work now, + other cleanup
Diffstat (limited to 'Source/Random.cpp')
| -rw-r--r-- | Source/Random.cpp | 4 |
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] | ||
| 10 | int Random::RandInt(int min, int max) { | 11 | int 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 | } |
