Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For <code>template&lt;class RealType, size_t bits, class URNG&gt; std::generate_canonical</code> the standard (section 27.5.7.2) explicitly defines the number of calls to the uniform random number generator (URNG) to be</p> <p>max(1, b / log_2 R),</p> <p>where b is the minimum of the number of bits in the mantissa of the RealType and the number of bits given to generate_canonical as template parameter. R is the range of numbers the URNG can return <code>(URNG::max()-URNG::min()+1)</code>. However, in your example this will not make any difference, since you need 2 calls to the mt19937 to fill the 53 bits of the mantissa of the double.</p> <p>For other distributions the standard does not provide a generic way to get any information on how many numbers the URNG has to generate to obtain one number of the distribution.</p> <p>A reason might be that for some distributions the number uniform random numbers required to generate a single number of the distribution is not fixed and may vary from call to call. An example is the <code>std::poisson_distribution</code>, which is usually implemented as a loop which draws a uniform random number in each iteration until the product of these numbers has reached a certain threshold (see for example the <a href="http://gcc.gnu.org/git/?p=gcc.git;a=blob_plain;f=libstdc%2b%2b-v3/include/bits/random.tcc;hb=503700a925ac27ea615eecb149062442c869a0f0" rel="nofollow" title="random.tcc">implementation of the GNU C++ library</a> (line 1523-1528)).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload