class ReservoirSampler
Declaration
template <typename T, typename GenT>
class ReservoirSampler { /* full declaration omitted */ };
Description
Randomly selects an item by sampling into a set with an unknown number of elements, which may each be weighted to be more likely choices.
Declared at: llvm/include/llvm/FuzzMutate/Random.h:33
Templates
- T
- GenT
Method Overview
- public ReservoirSampler<T, GenT>(GenT & RandGen)
- public const T & getSelection() const
- public bool isEmpty() const
- public bool operator bool() const
- public ReservoirSampler<T, GenT> & sample(const T & Item, uint64_t Weight)
- public template <typename RangeT>ReservoirSampler<T, GenT> & sample(RangeT && Items)
- public uint64_t totalWeight() const
Methods
¶ReservoirSampler<T, GenT>(GenT& RandGen)
ReservoirSampler<T, GenT>(GenT& RandGen)
Declared at: llvm/include/llvm/FuzzMutate/Random.h:39
Parameters
- GenT& RandGen
¶const T& getSelection() const
const T& getSelection() const
Declared at: llvm/include/llvm/FuzzMutate/Random.h:44
¶bool isEmpty() const
bool isEmpty() const
Declared at: llvm/include/llvm/FuzzMutate/Random.h:42
¶bool operator bool() const
bool operator bool() const
Declared at: llvm/include/llvm/FuzzMutate/Random.h:49
¶ReservoirSampler<T, GenT>& sample(const T& Item,
uint64_t Weight)
ReservoirSampler<T, GenT>& sample(const T& Item,
uint64_t Weight)
Description
Sample a single item with the given weight.
Declared at: llvm/include/llvm/FuzzMutate/Random.h:60
Parameters
- const T& Item
- uint64_t Weight
¶template <typename RangeT>
ReservoirSampler<T, GenT>& sample(RangeT&& Items)
template <typename RangeT>
ReservoirSampler<T, GenT>& sample(RangeT&& Items)
Description
Sample each item in \c Items with unit weight
Declared at: llvm/include/llvm/FuzzMutate/Random.h:53
Templates
- RangeT
Parameters
- RangeT&& Items
¶uint64_t totalWeight() const
uint64_t totalWeight() const
Declared at: llvm/include/llvm/FuzzMutate/Random.h:41