summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/random_func.cpp1
-rw-r--r--src/core/random_func.hpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/core/random_func.cpp b/src/core/random_func.cpp
index dfdf9c869..588bcb7b2 100644
--- a/src/core/random_func.cpp
+++ b/src/core/random_func.cpp
@@ -57,6 +57,7 @@ uint32 DoRandom(int line, const char *file)
uint DoRandomRange(uint max, int line, const char *file)
{
+ assert(max <= UINT16_MAX);
return GB(DoRandom(line, file), 0, 16) * max >> 16;
}
#endif /* RANDOM_DEBUG */
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp
index d0e12ba92..03d49d718 100644
--- a/src/core/random_func.hpp
+++ b/src/core/random_func.hpp
@@ -99,8 +99,9 @@ void SetRandomSeed(uint32 seed);
return _random.Next();
}
- static FORCEINLINE uint32 RandomRange(uint16 max)
+ static FORCEINLINE uint32 RandomRange(uint max)
{
+ assert(max <= UINT16_MAX);
return _random.Next(max);
}
#endif