diff options
author | treeston <treeston.mmoc@gmail.com> | 2015-11-28 19:21:33 +0100 |
---|---|---|
committer | treeston <treeston.mmoc@gmail.com> | 2015-11-28 23:53:04 +0100 |
commit | c0faee079542c134925025a3c32c9324e750dfaa (patch) | |
tree | 2e76557d613fd2b41c4d46dc99ca5dfa22a88da3 /src/common/Utilities/Util.cpp | |
parent | e266278f7d029f1547b1ae3228d658463c69da09 (diff) |
Core/Util: Add a urandms(min,max) helper to make urand(min*IN_MILLISECONDS, max*IN_MILLISECONDS) shorter to write for random time intervals (boss scripts).
Diffstat (limited to 'src/common/Utilities/Util.cpp')
-rw-r--r-- | src/common/Utilities/Util.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 33c273fb05f..9f61dd12e4c 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -58,6 +58,13 @@ uint32 urand(uint32 min, uint32 max) return GetRng()->URandom(min, max); } +uint32 urandms(uint32 min, uint32 max) +{ + ASSERT(max >= min); + ASSERT(INT_MAX/IN_MILLISECONDS >= max); + return GetRng()->URandom(min * IN_MILLISECONDS, max * IN_MILLISECONDS); +} + float frand(float min, float max) { ASSERT(max >= min); |