0
$\begingroup$

A random number generator produces independent random variates $x_0, x_1, x_2, . . .$ drawn uniformly from $[0, 1]$, stopping at the first $x_T$ that is strictly less than $x_0$.

(a) Prove that the expected value of $T$ is infinite.

(b) Suggest, with a brief explanation, a plausible value of $Pr(T = ∞)$ for a real-world (pseudo-)random number generator implemented on a computer.

This is my answer for part (a):

Probability of lasting $T$ for a given $x_0$: $$ x_0(1-x_0)^{T-1}\tag{1} $$ Expected value of $T$ for a given $x_0$: $$ \begin{align} \sum_{T=1}^\infty Tx_0(1-x_0)^{T-1} &=-x_0\frac{\mathrm{d}}{\mathrm{d}x_0}\sum_{T=0}^\infty(1-x_0)^T\\ &=-x_0\frac{\mathrm{d}}{\mathrm{d}x_0}\frac1{1-(1-x_0)}\\ &=-x_0\frac{\mathrm{d}}{\mathrm{d}x_0}\frac1{x_0}\\ &=\frac1{x_0}\tag{2} \end{align} $$ By the linearity of expectation, we can compute the the expected value of $T$ for a random $x_0\in[0,1]$: $$ \int_0^1\frac1{x_0}\,\mathrm{d}x_0=\infty\tag{3} $$

I would like help with the solution to part (b).

2 Answers 2

1

On a computer you use floating point or fixed point arithmetic with some number of bits.

Lets say for convenience, you're working with 4 bit fixed point numbers with between 0 and 1, so you can get 0.0000, 0.0001, 0.0010, 0.0011, ..., 0.1111 in binary. Now, if you were to never stop, you'd need x_0 to be 0.0000 which happens with probability 1/2^4 (since there are 4 bits drawn uniformly).

Of course, on most computers, people use floating point or a higher precision fixed point, but you can adjust the idea to that.

2

For a real-world PRNG, the output takes only finitely many discrete values. Then $T=\infty$ can occur only if $x_0$ is the minimal possible value. For any decent PRNG, the probability of this occurring should be $\frac 1N$ where $N$ is the number of possible output values. Typical PRNGs return integer values with 31 or 63 bits, so $N=2^{31}$ or $N=2^{63}$. Even if a PRNG "natively" returns floats (or doubles) from a certain range, the number $N$ is dictated by the precision of these values