![]() |
Home | Libraries | People | FAQ | More |
boost::unit_test::data::random — Returns an infinite sequence of random numbers.
// In header: <boost/test/data/monomorphic/generators/random.hpp> monomorphic::generated_by< monomorphic::random_t<> > random();
The following overloads are available:
auto d = random(); auto d = random(begin, end); auto d = random(params);
The first overload uses the default distribution, which is uniform and which elements are double type (the values are in [0, 1) ).
The second overload generates numbers in the given interval. The distribution is uniform (in [begin, end) for real numbers, and in [begin, end] for integers). The type of the distribution is deduced from the type of the begin and end parameters.
The third overload generates numbers using the named parameter inside params , which are:
distribution: the distribution used. In this overload, since the type of the samples cannot be deduced, the samples are of type double and the distribution is uniform real in [0, 1).
seed: the seed for generating the values
engine: the random number generator engine
The function returns an object that implements the dataset API.
![]() |
Note |
|---|---|
This function is available only for C++11 capable compilers. |