QMCPACK
uniform_real_distribution_as_boost< T > Class Template Reference

generating real type random numbers [min, max) in a uniform distribution. More...

+ Inheritance diagram for uniform_real_distribution_as_boost< T >:
+ Collaboration diagram for uniform_real_distribution_as_boost< T >:

Public Types

using result_type = T
 

Public Member Functions

 uniform_real_distribution_as_boost (T min=T(0.0), T max=T(1.0))
 
template<typename RNG >
result_type operator() (RNG &eng)
 Generating functions. More...
 

Private Attributes

min_
 
max_
 

Detailed Description

template<typename T>
class qmcplusplus::uniform_real_distribution_as_boost< T >

generating real type random numbers [min, max) in a uniform distribution.

This is intended to match the behavior of random::uniform_real_distribution in the boost libraries Its behavor is different from std::uniform_real_distribution which uses std::generate_canonical to generate enough entropy according to the precision of T.

Definition at line 34 of file StdRandom.h.

Member Typedef Documentation

◆ result_type

using result_type = T

Definition at line 37 of file StdRandom.h.

Constructor & Destructor Documentation

◆ uniform_real_distribution_as_boost()

uniform_real_distribution_as_boost ( min = T(0.0),
max = T(1.0) 
)
inline

Member Function Documentation

◆ operator()()

result_type operator() ( RNG &  eng)
inline

Generating functions.

Definition at line 43 of file StdRandom.h.

44  {
45  return static_cast<result_type>(eng() - eng.min()) / (static_cast<result_type>(eng.max() - eng.min()) + 1) *
46  (max_ - min_) + min_;
47  }

Member Data Documentation

◆ max_

T max_
private

◆ min_

T min_
private

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