rnz is a function that generates a random number with a distribution that is meant to peak at a given value and trail off at larger values. A call of rnz(350), for example, gives the base prayer timeout and will often return a number close to 350, sometimes a number somewhat less or somewhat more than 350, and rarely a number much greater or much less than 350.
The most probable outcome turns out not to be the given parameter, but half of that number, as can be seen in the graph to the right.
rnz is used for the following purposes:
rnz(100) is the time that one must wait after invoking an artifact before invoking it again.
rnz(10) (or rnz(25) when first building a level ) plays a part in determining when a corpse disintegrates.
A number of rnz calls are used in determining the prayer timeout. In particular, the timeout after successful prayer is rnz(350), with a penalty of rnz(1000) added if you are crowned or have killed the Wizard of Yendor . If you have killed the Wizard and are also crowned, the penalty is doubled.
Mathematical analysis [ ]
rnz produces such a bizarre distribution that it is hard to tell what the original programmer had in mind. It's quite possible that it was meant to be some distribution with Z in the name, but its construction doesn't seem to suggest one.
The code is quoted below, with some cleanup for readability:
int
rnz(i)
int i;
{
register long x = i;
register long tmp = 1000;
tmp += rn2(1000);
tmp *= rne(4);
if (rn2(2)) { x *= tmp; x /= 1000; }
else { x *= 1000; x /= tmp; }
return((int)x);
}
Probability density function [ ]
The rn2(2) call chooses, with equal probability, between two different distributions; one is
i
⋅
rne
(
4
)
⋅
1000
+
rn2
(
1000
)
1000
{\displaystyle i \cdot \operatorname{rne}(4) \cdot \frac{1000 + \operatorname{rn2}(1000)}{1000}}
and the other is
i
⋅
[
rne
(
4
)
⋅
1000
+
rn2
(
1000
)
1000
]
−
1
{\displaystyle i \cdot \left[ \operatorname{rne}(4) \cdot \frac{1000 + \operatorname{rn2}(1000)}{1000} \right]^{-1}}
.
The function is easier to analyze if the expression
1000
+
rn2
(
1000
)
1000
{\displaystyle \frac{1000 + \operatorname{rn2}(1000)}{1000}}
is modeled as a continuous uniformly distributed variable with range from 1 to 2. Let this variable be called z . For the case where the variable i is divided by the random formula, it helps to know the distribution of the reciprocal of z; it is z-2 for 0.5 <= z <= 1, and 0 otherwise.
The rne (4) call returns an integer from 1 to 5, with the following probabilities:
Return
Probability
1
3/4
2
3/16
3
3/64
4
3/256
5
1/256
If the hero's experience level is 18 or greater, then rne can return numbers greater than 5; but this event has low probability (1/1024 for all experience levels 18 or greater), and to keep this explanation simple it will not be considered.
We can now consider all possible outcomes of the rn2(2) and rne(4) calls:
rn2(2) returns
rne(4) returns
Probability
Outcome
Range
Distribution
1
5
1
512
{\displaystyle \frac{1}{512}}
1
5
z
{\displaystyle \frac{1}{5z}}
1
10
{\displaystyle \frac{1}{10}}
to
1
5
{\displaystyle \frac{1}{5}}
x
−
2
2560
{\displaystyle \frac{x^{-2}}{2560}}
1
4
3
512
{\displaystyle \frac{3}{512}}
1
4
z
{\displaystyle \frac{1}{4z}}
1
8
{\displaystyle \frac{1}{8}}
to
1
4
{\displaystyle \frac{1}{4}}
3
x
−
2
2048
{\displaystyle \frac{3x^{-2}}{2048}}
1
3
3
128
{\displaystyle \frac{3}{128}}
1
3
z
{\displaystyle \frac{1}{3z}}
1
6
{\displaystyle \frac{1}{6}}
to
1
3
{\displaystyle \frac{1}{3}}
x
−
2
128
{\displaystyle \frac{x^{-2}}{128}}
1
2
3
32
{\displaystyle \frac{3}{32}}
1
2
z
{\displaystyle \frac{1}{2z}}
1
4
{\displaystyle \frac{1}{4}}
to
1
2
{\displaystyle \frac{1}{2}}
3
x
−
2
64
{\displaystyle \frac{3x^{-2}}{64}}
1
1
3
8
{\displaystyle \frac{3}{8}}
1
z
{\displaystyle \frac{1}{z}}
1
2
{\displaystyle \frac{1}{2}}
to
1
{\displaystyle 1}
3
x
−
2
8
{\displaystyle \frac{3x^{-2}}{8}}
0
1
3
8
{\displaystyle \frac{3}{8}}
z
{\displaystyle z}
1
{\displaystyle 1}
to
2
{\displaystyle 2}
3
8
{\displaystyle \frac{3}{8}}
0
2
3
32
{\displaystyle \frac{3}{32}}
2
z
{\displaystyle 2z}
2
{\displaystyle 2}
to
4
{\displaystyle 4}
3
64
{\displaystyle \frac{3}{64}}
0
3
3
128
{\displaystyle \frac{3}{128}}
3
z
{\displaystyle 3z}
3
{\displaystyle 3}
to
6
{\displaystyle 6}
1
128
{\displaystyle \frac{1}{128}}
0
4
3
512
{\displaystyle \frac{3}{512}}
4
z
{\displaystyle 4z}
4
{\displaystyle 4}
to
8
{\displaystyle 8}
3
2048
{\displaystyle \frac{3}{2048}}
0
5
1
512
{\displaystyle \frac{1}{512}}
5
z
{\displaystyle 5z}
5
{\displaystyle 5}
to
10
{\displaystyle 10}
1
2560
{\displaystyle \frac{1}{2560}}
Where the ranges overlap, the distributions add:
Range
Distribution
1
10
{\displaystyle \frac{1}{10}}
to
1
8
{\displaystyle \frac{1}{8}}
x
−
2
2560
{\displaystyle \frac{x^{-2}}{2560}}
1
8
{\displaystyle \frac{1}{8}}
to
1
6
{\displaystyle \frac{1}{6}}
19
x
−
2
10240
{\displaystyle \frac{19x^{-2}}{10240}}
1
6
{\displaystyle \frac{1}{6}}
to
1
5
{\displaystyle \frac{1}{5}}
99
x
−
2
10240
{\displaystyle \frac{99x^{-2}}{10240}}
1
5
{\displaystyle \frac{1}{5}}
to
1
4
{\displaystyle \frac{1}{4}}
19
x
−
2
2048
{\displaystyle \frac{19x^{-2}}{2048}}
1
4
{\displaystyle \frac{1}{4}}
to
1
3
{\displaystyle \frac{1}{3}}
7
x
−
2
128
{\displaystyle \frac{7x^{-2}}{128}}
1
3
{\displaystyle \frac{1}{3}}
to
1
2
{\displaystyle \frac{1}{2}}
3
x
−
2
64
{\displaystyle \frac{3x^{-2}}{64}}
1
2
{\displaystyle \frac{1}{2}}
to
1
{\displaystyle 1}
3
x
−
2
8
{\displaystyle \frac{3x^{-2}}{8}}
1
{\displaystyle 1}
to
2
{\displaystyle 2}
3
8
{\displaystyle \frac{3}{8}}
2
{\displaystyle 2}
to
3
{\displaystyle 3}
3
64
{\displaystyle \frac{3}{64}}
3
{\displaystyle 3}
to
4
{\displaystyle 4}
7
128
{\displaystyle \frac{7}{128}}
4
{\displaystyle 4}
to
5
{\displaystyle 5}
19
2048
{\displaystyle \frac{19}{2048}}
5
{\displaystyle 5}
to
6
{\displaystyle 6}
99
10240
{\displaystyle \frac{99}{10240}}
6
{\displaystyle 6}
to
8
{\displaystyle 8}
19
10240
{\displaystyle \frac{19}{10240}}
8
{\displaystyle 8}
to
10
{\displaystyle 10}
1
2560
{\displaystyle \frac{1}{2560}}
This random variable, multiplied by the parameter i , is the return value of rnz.
Mean [ ]
If
p
(
x
)
{\displaystyle p(x)}
is the probability density function of a continuous random variable , then the mean of the variable is
∫
−
∞
∞
x
p
(
x
)
d
x
.
{\displaystyle \int_{-\infty}^\infty x \, p(x)\, \operatorname{d}x .}
For the continuous random variable described by the table at the end of the previous section, we find:
Range
p
(
x
)
{\displaystyle p(x)}
x
p
(
x
)
{\displaystyle x p(x)}
indefinite integral
definite integral
−
∞
{\displaystyle -\infty }
to
1
10
{\displaystyle \frac{1}{10}}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
1
10
{\displaystyle \frac{1}{10}}
to
1
8
{\displaystyle \frac{1}{8}}
x
−
2
2560
{\displaystyle \frac{x^{-2}}{2560}}
x
−
1
2560
{\displaystyle \frac{x^{-1}}{2560}}
ln
(
x
)
2560
{\displaystyle \frac{\ln(x)}{2560}}
ln
(
1
/
8
)
−
ln
(
1
/
10
)
2560
{\displaystyle \frac{\ln(1/8)-\ln(1/10)}{2560}}
1
8
{\displaystyle \frac{1}{8}}
to
1
6
{\displaystyle \frac{1}{6}}
19
x
−
2
10240
{\displaystyle \frac{19x^{-2}}{10240}}
19
x
−
1
10240
{\displaystyle \frac{19x^{-1}}{10240}}
19
ln
(
x
)
10240
{\displaystyle \frac{19\ln(x)}{10240}}
19
(
ln
(
1
/
6
)
−
ln
(
1
/
8
)
)
10240
{\displaystyle \frac{19(\ln(1/6)-\ln(1/8))}{10240}}
1
6
{\displaystyle \frac{1}{6}}
to
1
5
{\displaystyle \frac{1}{5}}
99
x
−
2
10240
{\displaystyle \frac{99x^{-2}}{10240}}
99
x
−
1
10240
{\displaystyle \frac{99x^{-1}}{10240}}
99
ln
(
x
)
10240
{\displaystyle \frac{99\ln(x)}{10240}}
99
(
ln
(
1
/
5
)
−
ln
(
1
/
6
)
)
10240
{\displaystyle \frac{99(\ln(1/5)-\ln(1/6))}{10240}}
1
5
{\displaystyle \frac{1}{5}}
to
1
4
{\displaystyle \frac{1}{4}}
19
x
−
2
2048
{\displaystyle \frac{19x^{-2}}{2048}}
19
x
−
1
2048
{\displaystyle \frac{19x^{-1}}{2048}}
19
ln
(
x
)
2048
{\displaystyle \frac{19\ln(x)}{2048}}
19
(
ln
(
1
/
4
)
−
ln
(
1
/
5
)
)
2048
{\displaystyle \frac{19(\ln(1/4)-\ln(1/5))}{2048}}
1
4
{\displaystyle \frac{1}{4}}
to
1
3
{\displaystyle \frac{1}{3}}
7
x
−
2
128
{\displaystyle \frac{7x^{-2}}{128}}
7
x
−
1
128
{\displaystyle \frac{7x^{-1}}{128}}
7
ln
(
x
)
128
{\displaystyle \frac{7\ln(x)}{128}}
7
(
ln
(
1
/
3
)
−
ln
(
1
/
4
)
)
128
{\displaystyle \frac{7(\ln(1/3)-\ln(1/4))}{128}}
1
3
{\displaystyle \frac{1}{3}}
to
1
2
{\displaystyle \frac{1}{2}}
3
x
−
2
64
{\displaystyle \frac{3x^{-2}}{64}}
3
x
−
1
64
{\displaystyle \frac{3x^{-1}}{64}}
3
ln
(
x
)
64
{\displaystyle \frac{3\ln(x)}{64}}
3
(
ln
(
1
/
2
)
−
ln
(
1
/
3
)
)
64
{\displaystyle \frac{3(\ln(1/2)-\ln(1/3))}{64}}
1
2
{\displaystyle \frac{1}{2}}
to
1
{\displaystyle 1}
3
x
−
2
8
{\displaystyle \frac{3x^{-2}}{8}}
3
x
−
1
8
{\displaystyle \frac{3x^{-1}}{8}}
3
ln
(
x
)
8
{\displaystyle \frac{3\ln(x)}{8}}
−
3
ln
(
1
/
2
)
8
{\displaystyle \frac{-3\ln(1/2)}{8}}
1
{\displaystyle 1}
to
2
{\displaystyle 2}
3
8
{\displaystyle \frac{3}{8}}
3
x
8
{\displaystyle \frac{3x}{8}}
3
x
2
16
{\displaystyle \frac{3x^{2}}{16}}
9
16
{\displaystyle \frac{9}{16}}
2
{\displaystyle 2}
to
3
{\displaystyle 3}
3
64
{\displaystyle \frac{3}{64}}
3
x
64
{\displaystyle \frac{3x}{64}}
3
x
2
128
{\displaystyle \frac{3x^{2}}{128}}
15
128
{\displaystyle \frac{15}{128}}
3
{\displaystyle 3}
to
4
{\displaystyle 4}
7
128
{\displaystyle \frac{7}{128}}
7
x
128
{\displaystyle \frac{7x}{128}}
7
x
2
256
{\displaystyle \frac{7x^{2}}{256}}
49
256
{\displaystyle \frac{49}{256}}
4
{\displaystyle 4}
to
5
{\displaystyle 5}
19
2048
{\displaystyle \frac{19}{2048}}
19
x
2048
{\displaystyle \frac{19x}{2048}}
19
x
2
4096
{\displaystyle \frac{19x^{2}}{4096}}
171
4096
{\displaystyle \frac{171}{4096}}
5
{\displaystyle 5}
to
6
{\displaystyle 6}
99
10240
{\displaystyle \frac{99}{10240}}
99
x
10240
{\displaystyle \frac{99x}{10240}}
99
x
2
20480
{\displaystyle \frac{99x^{2}}{20480}}
1089
20480
{\displaystyle \frac{1089}{20480}}
6
{\displaystyle 6}
to
8
{\displaystyle 8}
19
10240
{\displaystyle \frac{19}{10240}}
19
x
10240
{\displaystyle \frac{19x}{10240}}
19
x
2
20480
{\displaystyle \frac{19x^{2}}{20480}}
133
5120
{\displaystyle \frac{133}{5120}}
8
{\displaystyle 8}
to
10
{\displaystyle 10}
1
2560
{\displaystyle \frac{1}{2560}}
x
2560
{\displaystyle \frac{x}{2560}}
x
2
5120
{\displaystyle \frac{x^{2}}{5120}}
9
1280
{\displaystyle \frac{9}{1280}}
10
{\displaystyle 10}
to
+
∞
{\displaystyle +\infty }
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
The sum of the definite integrals looks complicated at first, but by applying the laws of logarithms it can be reduced to
μ
=
ln
(
2
)
⋅
4419
10240
+
1023
1024
≈
1.29815.
{\displaystyle \mu = \ln(2) \cdot \frac{4419}{10240}+\frac{1023}{1024} \approx 1.29815.}
Thus the mean result of a call to rnz(x) is 1.29815x. The mean prayer timeout, then, is 454.351 turns. (Actually, it is 453.787, so the error introduced by treating Z as continuous is quite small.)
Standard deviation [ ]
The standard deviation of a variable with probability density function
p
(
x
)
{\displaystyle p(x)}
and mean
μ
{\displaystyle \mu}
is:
σ
=
∫
−
∞
∞
(
x
−
μ
)
2
p
(
x
)
d
x
.
{\displaystyle \sigma = \sqrt{\int_{-\infty}^\infty (x-\mu)^2 \, p(x) \, dx} .}
Since
μ
{\displaystyle \mu}
is a constant, we carry it through the calculation and substitute it at the end. The integral under the square root sign is the variance and we calculate it thus:
Range
f
(
x
)
{\displaystyle f(x)}
(
x
−
μ
)
2
p
(
x
)
{\displaystyle (x-\mu)^2 p(x)}
indefinite integral
definite integral
−
∞
{\displaystyle -\infty }
to
1
10
{\displaystyle \frac{1}{10}}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
1
10
{\displaystyle \frac{1}{10}}
to
1
8
{\displaystyle \frac{1}{8}}
x
−
2
2560
{\displaystyle \frac{x^{-2}}{2560}}
1
−
2
x
−
1
μ
+
x
−
2
μ
2
2560
{\displaystyle \frac{1-2x^{-1}\mu+x^{-2}\mu^2}{2560}}
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
2560
{\displaystyle \frac{x-2\ln(x)\mu-x^{-1}\mu^2}{2560}}
1
/
40
+
2
μ
2
+
2
ln
(
8
)
μ
−
2
ln
(
10
)
μ
2560
{\displaystyle \frac{1/40+2\mu^2+2\ln(8)\mu-2\ln(10)\mu}{2560}}
1
8
{\displaystyle \frac{1}{8}}
to
1
6
{\displaystyle \frac{1}{6}}
19
x
−
2
10240
{\displaystyle \frac{19x^{-2}}{10240}}
19
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
10240
{\displaystyle \frac{19(1-2x^{-1}\mu+x^{-2}\mu^2)}{10240}}
19
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
10240
{\displaystyle \frac{19(x-2\ln(x)\mu-x^{-1}\mu^2)}{10240}}
19
(
1
/
24
+
2
μ
2
+
2
ln
(
6
)
μ
−
2
ln
(
8
)
μ
)
10240
{\displaystyle \frac{19(1/24+2\mu^2+2\ln(6)\mu-2\ln(8)\mu)}{10240}}
1
6
{\displaystyle \frac{1}{6}}
to
1
5
{\displaystyle \frac{1}{5}}
99
x
−
2
10240
{\displaystyle \frac{99x^{-2}}{10240}}
99
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
10240
{\displaystyle \frac{99(1-2x^{-1}\mu+x^{-2}\mu^2)}{10240}}
99
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
10240
{\displaystyle \frac{99(x-2\ln(x)\mu-x^{-1}\mu^2)}{10240}}
99
(
1
/
30
+
μ
2
+
2
ln
(
5
)
μ
−
2
ln
(
6
)
μ
)
10240
{\displaystyle \frac{99(1/30+\mu^2+2\ln(5)\mu-2\ln(6)\mu)}{10240}}
1
5
{\displaystyle \frac{1}{5}}
to
1
4
{\displaystyle \frac{1}{4}}
19
x
−
2
2048
{\displaystyle \frac{19x^{-2}}{2048}}
19
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
2048
{\displaystyle \frac{19(1-2x^{-1}\mu+x^{-2}\mu^2)}{2048}}
19
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
2048
{\displaystyle \frac{19(x-2\ln(x)\mu-x^{-1}\mu^2)}{2048}}
19
(
1
/
20
+
μ
2
+
2
ln
(
4
)
μ
−
2
ln
(
5
)
μ
)
2048
{\displaystyle \frac{19(1/20+\mu^2+2\ln(4)\mu-2\ln(5)\mu)}{2048}}
1
4
{\displaystyle \frac{1}{4}}
to
1
3
{\displaystyle \frac{1}{3}}
7
x
−
2
128
{\displaystyle \frac{7x^{-2}}{128}}
7
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
128
{\displaystyle \frac{7(1-2x^{-1}\mu+x^{-2}\mu^2)}{128}}
7
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
128
{\displaystyle \frac{7(x-2\ln(x)\mu-x^{-1}\mu^2)}{128}}
7
(
1
/
12
+
μ
2
+
2
ln
(
3
)
μ
−
2
ln
(
4
)
μ
)
128
{\displaystyle \frac{7(1/12+\mu^2+2\ln(3)\mu-2\ln(4)\mu)}{128}}
1
3
{\displaystyle \frac{1}{3}}
to
1
2
{\displaystyle \frac{1}{2}}
3
x
−
2
64
{\displaystyle \frac{3x^{-2}}{64}}
3
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
64
{\displaystyle \frac{3(1-2x^{-1}\mu+x^{-2}\mu^2)}{64}}
3
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
64
{\displaystyle \frac{3(x-2\ln(x)\mu-x^{-1}\mu^2)}{64}}
3
(
1
/
6
+
μ
2
+
2
ln
(
2
)
μ
−
2
ln
(
3
)
μ
)
64
{\displaystyle \frac{3(1/6+\mu^2+2\ln(2)\mu-2\ln(3)\mu)}{64}}
1
2
{\displaystyle \frac{1}{2}}
to
1
{\displaystyle 1}
3
x
−
2
8
{\displaystyle \frac{3x^{-2}}{8}}
3
(
1
−
2
x
−
1
μ
+
x
−
2
μ
2
)
8
{\displaystyle \frac{3(1-2x^{-1}\mu+x^{-2}\mu^2)}{8}}
3
(
x
−
2
ln
(
x
)
μ
−
x
−
1
μ
2
)
8
{\displaystyle \frac{3(x-2\ln(x)\mu-x^{-1}\mu^2)}{8}}
3
(
1
/
2
+
μ
2
−
2
ln
(
2
)
μ
)
8
{\displaystyle \frac{3(1/2+\mu^2-2\ln(2)\mu)}{8}}
1
{\displaystyle 1}
to
2
{\displaystyle 2}
3
8
{\displaystyle \frac{3}{8}}
3
(
x
2
−
2
x
μ
+
μ
2
)
8
{\displaystyle \frac{3(x^2-2x\mu+\mu^2)}{8}}
3
(
x
3
3
−
x
2
μ
+
x
μ
2
)
8
{\displaystyle \frac{3(\frac{x^3}{3}-x^2\mu+x\mu^2)}{8}}
3
(
7
/
3
−
3
μ
+
μ
2
)
8
{\displaystyle \frac{3(7/3-3\mu+\mu^2)}{8}}
2
{\displaystyle 2}
to
3
{\displaystyle 3}
3
64
{\displaystyle \frac{3}{64}}
3
(
x
2
−
2
x
μ
+
μ
2
)
64
{\displaystyle \frac{3(x^2-2x\mu+\mu^2)}{64}}
3
(
x
3
3
−
x
2
μ
+
x
μ
2
)
64
{\displaystyle \frac{3(\frac{x^3}{3}-x^2\mu+x\mu^2)}{64}}
3
(
19
/
3
−
5
μ
+
μ
2
)
64
{\displaystyle \frac{3(19/3-5\mu+\mu^2)}{64}}
3
{\displaystyle 3}
to
4
{\displaystyle 4}
7
128
{\displaystyle \frac{7}{128}}
7
(
x
2
−
2
x
μ
+
μ
2
)
128
{\displaystyle \frac{7(x^2-2x\mu+\mu^2)}{128}}
7
(
x
3
3
−
x
2
μ
+
x
μ
2
)
128
{\displaystyle \frac{7(\frac{x^3}{3}-x^2\mu+x\mu^2)}{128}}
7
(
37
/
3
−
7
μ
+
μ
2
)
128
{\displaystyle \frac{7(37/3-7\mu+\mu^2)}{128}}
4
{\displaystyle 4}
to
5
{\displaystyle 5}
19
2048
{\displaystyle \frac{19}{2048}}
19
(
x
2
−
2
x
μ
+
μ
2
)
2048
{\displaystyle \frac{19(x^2-2x\mu+\mu^2)}{2048}}
19
(
x
3
3
−
x
2
μ
+
x
μ
2
)
2048
{\displaystyle \frac{19(\frac{x^3}{3}-x^2\mu+x\mu^2)}{2048}}
19
(
61
/
3
−
9
μ
+
μ
2
)
2048
{\displaystyle \frac{19(61/3-9\mu+\mu^2)}{2048}}
5
{\displaystyle 5}
to
6
{\displaystyle 6}
99
10240
{\displaystyle \frac{99}{10240}}
99
(
x
2
−
2
x
μ
+
μ
2
)
10240
{\displaystyle \frac{99(x^2-2x\mu+\mu^2)}{10240}}
99
(
x
3
3
−
x
2
μ
+
x
μ
2
)
10240
{\displaystyle \frac{99(\frac{x^3}{3}-x^2\mu+x\mu^2)}{10240}}
99
(
91
/
3
−
11
μ
+
μ
2
)
10240
{\displaystyle \frac{99(91/3-11\mu+\mu^2)}{10240}}
6
{\displaystyle 6}
to
8
{\displaystyle 8}
19
10240
{\displaystyle \frac{19}{10240}}
19
(
x
2
−
2
x
μ
+
μ
2
)
10240
{\displaystyle \frac{19(x^2-2x\mu+\mu^2)}{10240}}
19
(
x
3
3
−
x
2
μ
+
x
μ
2
)
10240
{\displaystyle \frac{19(\frac{x^3}{3}-x^2\mu+x\mu^2)}{10240}}
19
(
296
/
3
−
28
μ
+
2
μ
2
)
10240
{\displaystyle \frac{19(296/3-28\mu+2\mu^2)}{10240}}
8
{\displaystyle 8}
to
10
{\displaystyle 10}
1
2560
{\displaystyle \frac{1}{2560}}
x
2
−
2
x
μ
+
μ
2
2560
{\displaystyle \frac{x^2-2x\mu+\mu^2}{2560}}
x
3
3
−
x
2
μ
+
x
μ
2
2560
{\displaystyle \frac{\frac{x^3}{3}-x^2\mu+x\mu^2}{2560}}
488
/
3
−
36
μ
+
2
μ
2
2560
{\displaystyle \frac{488/3-36\mu+2\mu^2}{2560}}
10
{\displaystyle 10}
to
+
∞
{\displaystyle +\infty }
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
0
{\displaystyle 0}
Collecting terms and applying the laws of logarithms gives
1136891
409600
−
μ
(
1023
512
+
ln
(
2
)
4419
5120
)
+
μ
2
{\displaystyle \frac{1136891}{409600}-\mu\left(\frac{1023}{512}+\ln(2)\frac{4419}{5120}\right)+\mu^2}
and substituting the value of
μ
{\displaystyle \mu}
gives
46597799
26214400
−
ln
(
2
)
4520637
5242880
−
ln
2
(
2
)
19527561
104857600
.
{\displaystyle \frac{46597799}{26214400}-\ln(2)\frac{4520637}{5242880}-\ln^2(2)\frac{19527561}{104857600}.}
This is the variance of the underlying variable; the standard deviation is its square root:
σ
=
46597799
26214400
−
ln
(
2
)
4520637
5242880
−
ln
2
(
2
)
19527561
104857600
≈
1.04424.
{\displaystyle \sigma = \sqrt{\frac{46597799}{26214400}-\ln(2)\frac{4520637}{5242880}-\ln^2(2)\frac{19527561}{104857600}} \approx 1.04424.}
The standard deviation of rnz(x), then, is 1.04424x, or 365.483 for an ordinary prayer timeout. (Actually, it is 365.344, so the error introduced by treating Z as continuous is quite small.)