coreutils
[Top][All Lists]
Advanced

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

Re: Generating pseudo-random integers


From: Bob Proulx
Subject: Re: Generating pseudo-random integers
Date: Sat, 5 Feb 2011 12:04:08 -0700
User-agent: Mutt/1.5.20 (2009-06-14)

Melikamp The Medley wrote:
> Bob Proulx wrote:
> >> and link it with coreutils.
> > Why?
> 
> So that I don't have to write a new PRNG, or anything, really, besides
> a CL option parser. I would rather use ISAAC and randint.

If you use awk or perl then you still don't have to do that.  So that
isn't yet a reason for pushing this into coreutils.

> Bob Proulx wrote:
> >   awk 'BEGIN{srand();for(i=0;i<1000;++i){print int(100*rand());}}'
> Jim Meyering wrote:
> > $ perl -le 'foreach (1..20) { print int rand 1000 }'
> 
> This should introduce the rounding bias, small as it is. I want
> the integer-generating algorithm to have no bias on the assumption
> that I have a truly random source.

I am an engineer, not a theoretical mathematician, but I see no
rounding bias there.  Why do you think that awk's and perl's random
number generators including rounding bias?  Please provide information
indicating the problem.  They have both been extensively analyzed and
peer reviewed.  If you really believe you have found a problem with
them then you should report the problem to them so that they get fixed
and everyone benefits.

Bob

-- 
The generation of random numbers is too important to be left to chance.
  -- Robert R. Coveyou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]