std::uniform_real_distribution (3) - Linux Manuals
std::uniform_real_distribution: std::uniform_real_distribution
NAME
std::uniform_real_distribution - std::uniform_real_distribution
Synopsis
Defined in header <random>
template< class RealType = double > (since C++11)
class uniform_real_distribution;
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
Template parameters
RealType - The result type generated by the generator. The effect is undefined if this is not one of float, double, or long double.
Member types
Member type Definition
result_type RealType
param_type the type of the parameter set, see RandomNumberDistribution.
Member functions
constructor (public member function)
reset (public member function)
Generation
operator() (public member function)
Characteristics
a (public member function)
b
param (public member function)
min (public member function)
max (public member function)
Non-member functions
operator== (function)
operator!=
operator<< (function template)
operator>>
Notes
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
Example
print 10 random numbers between 1 and 2
// Run this code
Possible output: