Template Class DiscreteRandomVariable

Class Documentation

template<typename PrecisionT>
class DiscreteRandomVariable

Generate samples using the alias method.

Template Parameters

PrecisionT – Precision data type

Public Functions

inline DiscreteRandomVariable(std::mt19937 &gen, const std::vector<PrecisionT> &probs)

Create a DiscreteRandomVariable object.

Parameters
  • gen – Random number generator reference.

  • probs – Probabilities for values 0 up to N - 1, where N = probs.size().

inline std::size_t operator()() const

Return a discrete random value.