This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\catcode`@ 11 | |
\long\def\@gobble#1{} | |
%\long\def\JFB@stop@firstoftwo#1#2{\z@#1} | |
\long\def\JFB@stop@secondoftwo#1#2{\z@#2} | |
\long\def\JFB@stop@thirdoffour#1#2#3#4{\z@#3} | |
\long\def\JFB@CheckWhetherBrace#1{% | |
\romannumeral | |
\expandafter\@gobble\expandafter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env/python | |
""" | |
This is occupied with finding impact on non-uniformity of evaluating | |
R times 0,X1Y1Y0X0 in an approximate way which neglects the lowest | |
order term R0 * X0 | |
Compared to absolute bound 2**(-24) of exact formula near 2**32, | |
we can not make it much worse because the worst we found is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> test_highbit_tex(12345, 100000, 129) | |
TeX with seed 12345 and runs of length 129 | |
skipping first 54 | |
{0: 49272, 1: 50728} | |
TeX: observed probability of more 1s after 100000 batches of 129 is 0.50728 | |
Power_divergenceResult(statistic=21.19936, pvalue=4.1390270194375e-06) | |
>>> test_highbit_py(82297, 100000, 129) | |
Python with seed 82297, runs of length 129, 100000 times | |
{0: 50120, 1: 49880} | |
Python: observed probability of more 1s after 100000 batches of 129 is 0.4988 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env/py | |
""" | |
Dimanche 06 mai 2018 à 22:18:52 | |
Pour comparaison entre \pdfuniformdeviate 2 et randrange(2) | |
""" | |
import random | |
from scipy.stats import chisquare |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Examining batches of 165 bits from \pdfuniformdeviate 2 | |
If more 1s than 0s count 1, else count 0. | |
There seems to be preponderance of case "more 1s than 0s" in case of seed 08035872, | |
situation looks more random for 10427991, when averaging over all possible | |
initial shifts. | |
+++++++++++++++++++++++ | |
10000 runs of 165 draws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HIGH BIT (\pdfuniformdeviate 2) | |
In successive batches of 165 draws, are there are more 1s than 0s | |
The answer is Yes on average for all initial shifts and the two | |
randomly chosen seeds 149847074 and 256844633 | |
(I should have taken the first one < 2**27, too late) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HIGH BIT SEEDS 0 AND 1 | |
It appears batches of 165 contains more 1s than 0s signifcantly, | |
and the effect is more pronounced for seed = 1. | |
It looks more random for batches of 55 and seed = 0, but again | |
seed = 1 gives more 1s | |
+++++++++++++++++++++++ | |
10000 runs of 165 draws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newcount\cnta | |
\newcount\cntb | |
\newcount\cntc | |
\newcount\cntd | |
\newcount\maxrand | |
\maxrand "10000000 | |
% \the\maxrand |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newcount\cnta | |
\newcount\cntb | |
\newcount\cntc | |
\newcount\cntd | |
\newcount\maxrand | |
\maxrand "10000000 | |
% \the\maxrand |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+++++++++++++++++++++++ | |
10000 runs of 165 draws | |
+++++++++++++++++++++++ | |
(shift=1, seed=0) 0:4666, 1:5334 | |
(shift=1, seed=1) 0:4723, 1:5277 | |
(shift=2, seed=0) 0:4635, 1:5365 | |
(shift=2, seed=1) 0:4735, 1:5265 |