11.2. StatisticsΒΆ
The numbers generated by random
are frequently distributed
uniformly. That means that each value in the range should be equally
likely. If we count the number of times each value appears, it should be
roughly the same for all values, provided that we generate a large
number of values.
In the next few sections, we will write programs that generate a sequence of random numbers and check whether this property holds true.
Although the uniform int distribution is both common and often desired, the C++ random library defines several other distributions useful in science and engineering, including:
and others that are part of these broad families of distributions.
The convenience and ease of use of these and other functions in the C++
random library is one of many excellent reasons to use them instead of the
rand()
family of functions they replace from the C library.
Q-1: Random numbers are frequently distributed __________.