LLVM 20.0.0git
|
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. More...
#include "llvm/FuzzMutate/Random.h"
Public Member Functions | |
ReservoirSampler (GenT &RandGen) | |
uint64_t | totalWeight () const |
bool | isEmpty () const |
const T & | getSelection () const |
operator bool () const | |
const T & | operator* () const |
template<typename RangeT > | |
ReservoirSampler & | sample (RangeT &&Items) |
Sample each item in Items with unit weight. | |
ReservoirSampler & | sample (const T &Item, uint64_t Weight) |
Sample a single item with the given weight. | |
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.
|
inline |
|
inline |
Definition at line 44 of file Random.h.
References assert(), llvm::ReservoirSampler< T, GenT >::isEmpty(), and Selection.
Referenced by llvm::ReservoirSampler< T, GenT >::operator*().
|
inline |
Definition at line 42 of file Random.h.
Referenced by llvm::ReservoirSampler< T, GenT >::getSelection(), and llvm::ReservoirSampler< T, GenT >::operator bool().
|
inlineexplicit |
Definition at line 49 of file Random.h.
References llvm::ReservoirSampler< T, GenT >::isEmpty().
|
inline |
Definition at line 50 of file Random.h.
References llvm::ReservoirSampler< T, GenT >::getSelection().
|
inline |
|
inline |
Sample each item in Items
with unit weight.
Definition at line 53 of file Random.h.
References I, and llvm::ReservoirSampler< T, GenT >::sample().
Referenced by llvm::makeSampler(), and llvm::ReservoirSampler< T, GenT >::sample().
|
inline |