The difference between the two systems gets smaller
with more bits. With M=2^51 the systems look quite different:
/* SWI-Prolog 8.5.18 */
?- M is (1<<51), between(1,10,_), stats(M, D),
N is log(D)/log(2), write(N), nl, fail; true.
38.030490564740845
36.64608133068678
39.90266908214614
39.40783704682056
31.502181228865066
38.46811325797751
37.23074324742856
36.82002406398337
34.9708016050052
38.75827431893174
/* Jekejeke Prolog 1.5.5 */
?- M is (1<<51), between(1,10,_), stats(M, D),
N is log(D)/log(2), write(N), nl, fail; true.
36.25036911731235
36.80713135437714
36.06365511352839
33.96122918542425
36.03296123667612
35.301308660385246
35.177861119830645
34.1454022656268
35.7980788891358
35.49236391391306
With M=2^201 the systems look rather similar:
?- M is (1<<201), between(1,10,_), stats(M, D),
N is log(D)/log(2), write(N), nl, fail; true.
189.53672010636757
188.95400489833128
187.3383068117556
188.6908371443576
188.22921137411072
186.30323985809352
188.6864997125651
189.79251475115166
189.2815717081842
190.26286276270744
/* Jekejeke Prolog 1.5.5 */
?- M is (1<<201), between(1,10,_), stats(M, D),
N is log(D)/log(2), write(N), nl, fail; true.
185.14260912573846
188.59895742142805
185.31313349159757
185.11803349540932
183.72143323996613
188.9781991830158
188.25081311791666
189.98099006923877
187.77570104217577
187.64532463688968
What does this mean? I guess the system with a smaller value is
possible the less good random generator, because some periodicity was hit.
Java uses a Lehmer algorithm which has a very short period and
uses very few bits in its state. On the other hand the Twister uses
quite some bits I guess, and has a much larger periodicity.
Twister would be therefore the better random number generator.
Edit 13.10.2022
Have to be careful to not get carried away, and should maybe introduce
some other testing on the random number generator. Main question is, can
I do a fuzzer on the SWI-Prolog platform so that it finds some float/1 test cases?
Actually this seems ok, so don’t worry! This was already affirmed in some other thread: