[Ecls-list] Random numbers not random enough

Waldek Hebisch hebisch at math.uni.wroc.pl
Mon Nov 30 19:20:19 UTC 2009


It seems that ECL random numbers have huge common factor:
ECL (Embeddable Common-Lisp) 9.11.1
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level.
> (defvar m)

M
> (setf m 778600)

778600
> (defvar a1)

A1
> (progn (setf a1 (random (expt 2 m))) nil)

NIL
> (defvar a2)

A2
> (progn (setf a2 (random (expt 2 m))) nil)

NIL
> (defvar res)

RES
> (progn (setf res (gcd a1 a2)) nil)

NIL
> (integer-length res)

778569
> (/ a1 res)

1158582938
> (/ a2 res)

3532539265
> (defvar a3)

A3
> (progn (setf a3 (random (expt 2 m))) nil)

NIL
> (defvar res2)

RES2
> (progn (setf res2 (gcd a1 a3)) nil)

NIL
> (integer-length res2)

778569


Such huge factor is very serious defect: it basically destroys
value of any number theoretic experiments with large numbers.

-- 
                              Waldek Hebisch
hebisch at math.uni.wroc.pl 




More information about the ecl-devel mailing list