Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions
gmx::UniformRealDistribution< RealType > Class Template Reference

#include <gromacs/random/uniformrealdistribution.h>

Description

template<class RealType = real>
class gmx::UniformRealDistribution< RealType >

Uniform real distribution.

The C++ standard library does provide this distribution, but even though they all sample from the correct distribution different standard library implementations appear to return different sequences of numbers for the same random number generator. To make it easier to use GROMACS unit tests that depend on random numbers we have our own implementation.

Template Parameters
RealTypeFloating-point type, real by default in GROMACS.

Classes

class  param_type
 Uniform real distribution parameters. More...
 

Public Types

typedef RealType result_type
 Type of values returned.
 

Public Member Functions

 UniformRealDistribution (result_type a=0.0, result_type b=1.0)
 Construct new distribution with given floating-point parameters. More...
 
 UniformRealDistribution (const param_type &param)
 Construct new distribution from parameter class. More...
 
void reset ()
 Flush all internal saved values.
 
template<class Rng >
result_type operator() (Rng &g)
 Return values from uniform real distribution with internal parameters. More...
 
template<class Rng >
result_type operator() (Rng &g, const param_type &param)
 Return value from uniform real distribution with given parameters. More...
 
result_type a () const
 Return the lower range uniform real distribution.
 
result_type b () const
 Return the upper range of the uniform real distribution.
 
param_type param () const
 Return the full parameter class of the uniform real distribution.
 
result_type min () const
 Smallest value that can be returned from uniform real distribution.
 
result_type max () const
 Largest value that can be returned from uniform real distribution.
 
bool operator== (const UniformRealDistribution &x) const
 True if two uniform real distributions will produce the same values. More...
 
bool operator!= (const UniformRealDistribution &x) const
 True if two uniform real distributions will produce different values. More...
 

Constructor & Destructor Documentation

template<class RealType = real>
gmx::UniformRealDistribution< RealType >::UniformRealDistribution ( result_type  a = 0.0,
result_type  b = 1.0 
)
inlineexplicit

Construct new distribution with given floating-point parameters.

Parameters
aLower end of range (inclusive)
bUpper end of range (exclusive)
template<class RealType = real>
gmx::UniformRealDistribution< RealType >::UniformRealDistribution ( const param_type param)
inlineexplicit

Construct new distribution from parameter class.

Parameters
paramParameter class as defined inside gmx::UniformRealDistribution.

Member Function Documentation

template<class RealType = real>
bool gmx::UniformRealDistribution< RealType >::operator!= ( const UniformRealDistribution< RealType > &  x) const
inline

True if two uniform real distributions will produce different values.

Parameters
xInstance to compare with.
template<class RealType = real>
template<class Rng >
result_type gmx::UniformRealDistribution< RealType >::operator() ( Rng &  g)
inline

Return values from uniform real distribution with internal parameters.

Template Parameters
RngRandom engine class
Parameters
gRandom engine
template<class RealType = real>
template<class Rng >
result_type gmx::UniformRealDistribution< RealType >::operator() ( Rng &  g,
const param_type param 
)
inline

Return value from uniform real distribution with given parameters.

Template Parameters
RngRandom engine class
Parameters
gRandom engine
paramParameters to use
template<class RealType = real>
bool gmx::UniformRealDistribution< RealType >::operator== ( const UniformRealDistribution< RealType > &  x) const
inline

True if two uniform real distributions will produce the same values.

Parameters
xInstance to compare with.

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