Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Algo/SelectRandomWeighted.h |
Include |
#include "Algo/SelectRandomWeighted.h" |
namespace Algo
{
template<typename RangeType, typename ProjectionType>
auto Algo::SelectRandomWeightedBy
(
RangeType && Range,
ProjectionType Proj
)
}
Randomly select an element from a range of elements, weighted by a projection. The chance of any element being chosen is its weight / the sum of all the weights in the range. Negative- or zero- weighted elements will not be chosen or count toward the total.
Parameter |
Description |
---|---|
Range |
The range to select from. Can be any iterable type. |
Proj |
The projection to weight the random selection by. Should yield a numeric type. |