Karim BELABAS on Thu, 1 Oct 1998 19:49:45 +0200 (MET DST)

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

Re: limit number of random

[Ilya writes:]
> Karim BELABAS writes:
> > random() never produced anything bigger than 2^31-1. But I agree this could
> > be useful. The following patch does what you want (and improves a bit the
> > previous version even if the bound is < 2^31). Apply it to 2.0.11, or wait
> > for 2.0.12 to be released.
> But it is not "random" any more.  There is no point in setting
> lesser-significance chunks to non-0, since they are calculatable based
> on higher-significance chunks anyway.
> THe simplest solution is to have a separate linear-congruence
> generator for higher precisions, with data being GENs, and these
> numbers 1000000000000654397 computed at runtime.
> Or (better) get a free 2048-independent-(bytes? bits?) generator from
> the pseudo-random webpage (if it deserves the trouble).

Well, it's definitely not "random" and it never was (linear-congruence
generators are bad anyway...), but if you're not after good statistical
properties, it gives you big numbers for your tests without too much hassle
(e.g if you want to check some functions on "random" input of fixed bit
size). I don't think it deserves the trouble. Internally, this function is
not used at all anyway, and you can always install() your custom
pseudo-random generator...

Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
PARI/GP Home Page: http://pari.home.ml.org