Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Algo
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Algo/SelectRandomWeighted.h |
| Include | #include "Algo/SelectRandomWeighted.h" |
namespace Algo
{
template<typename RangeType, typename ProjectionType>
auto Algo&58;&58;SelectRandomWeightedBy
&40;
RangeType && Range,
ProjectionType Proj
&41;
}
Remarks
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.
Parameters
| Name | 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. |