[latex3-commits] [git/LaTeX3-latex3-latex3] master: Improve code documentation for random as suggested by JF (a784341)
Bruno Le Floch
bruno at le-floch.fr
Mon May 7 19:29:03 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/a784341c538f5f54a401794f3ebfa6a652a7cb2a
>---------------------------------------------------------------
commit a784341c538f5f54a401794f3ebfa6a652a7cb2a
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Mon May 7 13:29:03 2018 -0400
Improve code documentation for random as suggested by JF
>---------------------------------------------------------------
a784341c538f5f54a401794f3ebfa6a652a7cb2a
l3kernel/l3fp-random.dtx | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/l3kernel/l3fp-random.dtx b/l3kernel/l3fp-random.dtx
index e0c2285..6ff7331 100644
--- a/l3kernel/l3fp-random.dtx
+++ b/l3kernel/l3fp-random.dtx
@@ -122,11 +122,17 @@
% will mostly call the RNG with such power of~$2$ arguments. If $N$
% does not divide $2^{28}$, then the relative non-uniformity (difference
% between probabilities of getting different numbers) is about
-% $N/2^{28}$ and could be detected after generating roughly $2^{56}/N^2$
-% random numbers. For instance for $N=98304=3\times 2^{15}$, the bias
-% modulo~$3$ would be detectable after roughly $2^{23}$ calls to the RNG
-% (experimentally this takes roughly a second on a 1 giga-hertz
-% processor). While this bias is not quite problematic, it is
+% $N/2^{28}$. This implies that detecting deviation from $1/N$ of the
+% probability of a fixed value X requires about $2^{56}/N$ random
+% trials. But collective patterns can reduce this to about
+% $2^{56}/N^2$. For instance with $N=3\times 2^{k}$, the modulo~$3$
+% repartition of such random numbers is biased with a non-uniformity
+% about $2^k/2^{28}$ (which is much worse than the circa $3/2^{28}$
+% non-uniformity from taking directly $N=3$). This is detectable after
+% about $2^{56}/2^{2k} = 9\cdot 2^{56}/N^2$ random numbers. For $k=15$,
+% $N=98304$, this means roughly $2^{26}$ calls to the RNG
+% (experimentally this takes about 4 seconds on a 2 giga-hertz
+% processor). While this bias is not quite problematic, it is
% uncomfortably close to being so, and it becomes worse as $N$ is
% increased. In our code, we shall thus combine several results from
% the RNG\@.
More information about the latex3-commits
mailing list