Namespaces
Variants
Actions

std::piecewise_constant_distribution

From cppreference.com
< cpp‎ | numeric‎ | random
 
 
 
 
 
Defined in header <random>
template< class RealType = double >
class piecewise_constant_distribution;
(since C++11)

std::piecewise_constant_distribution produces random floating-point numbers, which are uniformly distributed within each of the several subintervals [bi, bi+1), each with its own weight wi. The set of interval boundaries and the set of weights are the parameters of this distribution.

The probability density for any bi ≤ x <bi+1 is
wi
S (bi+1 - bi)
, where S is the sum of all weights.

std::piecewise_constant_distribution satisfies all requirements of RandomNumberDistribution.

Contents