diff options
Diffstat (limited to 'src/common/Utilities/Random.h')
-rw-r--r-- | src/common/Utilities/Random.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h index 94a36db42f6..ded0a6c6e5c 100644 --- a/src/common/Utilities/Random.h +++ b/src/common/Utilities/Random.h @@ -47,6 +47,9 @@ TC_COMMON_API double rand_norm(); /* Return a random double from 0.0 to 100.0 (exclusive). */ TC_COMMON_API double rand_chance(); +/* Return a random number in the range 0..count (exclusive) with each value having a different chance of happening */ +TC_COMMON_API uint32 urandweighted(size_t count, double const* chances); + /* Return true if a random roll fits in the specified chance (range 0-100). */ inline bool roll_chance_f(float chance) { |