#include <RandomLib/ExactPower.hpp>
Public Member Functions | |
| template<class Random> | |
| RandomNumber< bits > | operator() (Random &r, unsigned n) const |
Sample exactly from power distribution (n + 1) xn for x in (0,1) and integer n >= 0 using infinite precision. The template parameter bits specifies the number of bits in the base used for RandomNumber (i.e., base = 2bits).
Definition at line 27 of file ExactPower.hpp.
| RandomNumber< bits > RandomLib::ExactPower< bits >::operator() | ( | Random & | r, | |
| unsigned | n | |||
| ) | const [inline] |
Return the random deviate with a power distribution, (n + 1) xn for x in (0,1) and integer n >= 0. Returned result is a RandomNumber with base 2bits. For bits = 1, the number of random bits in the result and consumed are as follows:
n random bits
result consumed
0 0 0
1 2 4
2 2.33 6.67
3 2.67 9.24
4 2.96 11.71
5 3.20 14.11
6 3.41 16.45
7 3.59 18.75
8 3.75 21.01
9 3.89 23.25
10 4.02 25.47
Definition at line 63 of file ExactPower.hpp.
References RandomLib::RandomNumber< bits >::LessThan().
1.5.6