LLVM  6.0.0svn
Public Member Functions | List of all members
llvm::ReservoirSampler< T, GenT > Class Template Reference

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 TgetSelection () const
 
 operator bool () const
 
const Toperator* () const
 
template<typename RangeT >
ReservoirSamplersample (RangeT &&Items)
 Sample each item in Items with unit weight. More...
 
ReservoirSamplersample (const T &Item, uint64_t Weight)
 Sample a single item with the given weight. More...
 

Detailed Description

template<typename T, typename GenT>
class llvm::ReservoirSampler< T, GenT >

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.

Definition at line 34 of file Random.h.

Constructor & Destructor Documentation

◆ ReservoirSampler()

template<typename T, typename GenT>
llvm::ReservoirSampler< T, GenT >::ReservoirSampler ( GenT &  RandGen)
inline

Definition at line 40 of file Random.h.

Member Function Documentation

◆ getSelection()

template<typename T, typename GenT>
const T& llvm::ReservoirSampler< T, GenT >::getSelection ( ) const
inline

◆ isEmpty()

template<typename T, typename GenT>
bool llvm::ReservoirSampler< T, GenT >::isEmpty ( ) const
inline

◆ operator bool()

template<typename T, typename GenT>
llvm::ReservoirSampler< T, GenT >::operator bool ( ) const
inlineexplicit

Definition at line 50 of file Random.h.

References llvm::ReservoirSampler< T, GenT >::isEmpty().

◆ operator*()

template<typename T, typename GenT>
const T& llvm::ReservoirSampler< T, GenT >::operator* ( ) const
inline

Definition at line 51 of file Random.h.

References llvm::ReservoirSampler< T, GenT >::getSelection().

◆ sample() [1/2]

template<typename T, typename GenT>
template<typename RangeT >
ReservoirSampler& llvm::ReservoirSampler< T, GenT >::sample ( RangeT &&  Items)
inline

Sample each item in Items with unit weight.

Definition at line 54 of file Random.h.

References I.

Referenced by llvm::makeSampler().

◆ sample() [2/2]

template<typename T, typename GenT>
ReservoirSampler& llvm::ReservoirSampler< T, GenT >::sample ( const T Item,
uint64_t  Weight 
)
inline

Sample a single item with the given weight.

Definition at line 61 of file Random.h.

References llvm::sys::path::begin().

◆ totalWeight()

template<typename T, typename GenT>
uint64_t llvm::ReservoirSampler< T, GenT >::totalWeight ( ) const
inline

Definition at line 42 of file Random.h.


The documentation for this class was generated from the following file: