lppl  v2.0.0

◆ sample() [3/3]

template<typename D , typename RNG , typename... Ts>
DSType<D> sample ( record_t< DTypes< Ts... >> &  r,
std::string  address,
dist,
RNG &  rng,
std::optional< DSType< D >>  maybe_value 
)

Either samples a value from the specified distribution or observes a value against it, depending on whether data or null is passed as maybe_value.

Template Parameters
DThe type of distribution from which to sample
RNGThe type of PRNG to use
TsThe distribution types contained in the passed record
Parameters
rthe record into which to sample
addressthe address at which to sample
distthe distribution from which to draw sample(s)
rngthe PRNG to use for sampling
maybe_valueeither the value to observe, or std::nullopt to signal that a sample is desired.
Returns
DSType<D> the sampled value