Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
gmx::anonymous_namespace{coordstate.cpp} Namespace Reference

Functions

int getSampleFromDistribution (ArrayRef< const double > distr, int64_t seed, int64_t indexSeed0, int64_t indexSeed1)
 Generate a sample from a discrete probability distribution defined on [0, distr.size() - 1]. More...
 

Function Documentation

int gmx::anonymous_namespace{coordstate.cpp}::getSampleFromDistribution ( ArrayRef< const double >  distr,
int64_t  seed,
int64_t  indexSeed0,
int64_t  indexSeed1 
)

Generate a sample from a discrete probability distribution defined on [0, distr.size() - 1].

The pair (indexSeed0,indexSeed1) should be different for every invocation.

Parameters
[in]distrNormalized probability distribution to generate a sample from.
[in]seedRandom seed for initializing the random number generator.
[in]indexSeed0Random seed needed by the random number generator.
[in]indexSeed1Random seed needed by the random number generator.
Returns
a sample index in [0, distr.size() - 1]