Faker C++
Loading...
Searching...
No Matches
faker::helper::WeightedElement< T > Struct Template Reference

Get a random element by weight from a vector. More...

#include <helper.h>

Public Attributes

unsigned weight
 
value
 

Detailed Description

template<class T>
struct faker::helper::WeightedElement< T >

Get a random element by weight from a vector.

Template Parameters
Tan element type of the weighted element.
Parameters
datavector of weighted elements.
Returns
T a weighted element value from the vector.
{10, "value2"}}) // "hello2"
T weightedRandomElement(const std::vector< WeightedElement< T > > &data)
Definition helper.h:100
Get a random element by weight from a vector.
Definition helper.h:94

Member Data Documentation

◆ value

template<class T >
T faker::helper::WeightedElement< T >::value

◆ weight

template<class T >
unsigned faker::helper::WeightedElement< T >::weight

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