Bill Allombert on Wed, 30 Jun 2004 14:45:16 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

random() and random(2^31)


Hello PARI-dev,

random() documentation imply that random() is equivalent to random(2^31)
which is not true. In fact random(2^31) produce usually better results:

? #Set(vector(1024,i,sum(i=1,1024,random()%1024)))
%13 = 1
? #Set(vector(1024,i,sum(i=1,1024,random(2^31)%1024)))
%14 = 172

So either we fix the documentation or we change random() to be an alias
for random(2^31).

Of course there is a more general problem of improving the random number
generator of PARI. (The 172 above is bogus).

Cheers,
Bill.