|
LLVM 22.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 |
|
inline |
Definition at line 42 of file Random.h.
Referenced by getSelection(), and operator bool().
|
inlineexplicit |
|
inline |
Definition at line 50 of file Random.h.
References getSelection(), and T.
|
inline |
Sample a single item with the given weight.
Definition at line 60 of file Random.h.
References ReservoirSampler(), T, and llvm::uniform().
|
inline |
|
inline |