diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-03-21 21:04:01 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-03-21 21:04:01 +0100 |
commit | a1e3b54e076bf0361d23ace53703a4e501354d7c (patch) | |
tree | 8831e0f556df1d49c727cbedd3857a2258906eae /src/common/Utilities/Random.h | |
parent | 9cc5273cd27069d7abb8538eca20f429801b6f00 (diff) |
Core/Utils: Changed all Trinity::Containers utilities to work on all container types (including arrays where it makes sense)
* Added MapGetValuePtr to allow writing `if (Val* v = MapGetValuePtr(map, key))`
* Added utility IteratorPair class with begin/end methods and MapEqualRange for use in range for syntax with multimaps
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) { |