std::uniform_real_distribution (3) - Linux Manuals
std::uniform_real_distribution - std::uniform_real_distribution
Defined in header <random>
template< class RealType = double > (since C++11)
Produces random floating-point values i, uniformly distributed on the interval [a, b), that is, distributed according to the probability density function:
std::uniform_real_distribution satisfies all requirements of RandomNumberDistribution
RealType - The result type generated by the generator. The effect is undefined if this is not one of float, double, or long double.
Member type Definition
param_type the type of the parameter set, see RandomNumberDistribution.
constructor (public member function)
reset (public member function)
operator() (public member function)
a (public member function)
param (public member function)
min (public member function)
max (public member function)
operator<< (function template)
To create a distribution over the closed interval [a,b], std::nextafter(b, std::numeric_limits<RealType>::max()) may be used as the second parameter.
Some existing implementations have a bug where they may occasionally return b if RealType is float GCC_#63176 LLVM_#18767. This is caused by LWG_issue_2524
print 10 random numbers between 1 and 2
// Run this code