[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generating pseudo-random integers
From: |
Melikamp The Medley |
Subject: |
Re: Generating pseudo-random integers |
Date: |
Sat, 05 Feb 2011 05:14:43 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101213 Lightning/1.0b2 Lanikai/3.1.7 |
On 02/05/2011 02:20 AM, 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.
Jim Meyering wrote:
> However, adding an *option* to shuf might make sense
Indeed, if shuf had such an option, I'd be perfectly happy just using that.
Bob Proulx wrote:
> Please also state your
> rationale for needing something different.
> Want a random number between 0 and 9?
> awk 'BEGIN{srand();print int(10*rand());}'
> Want a thousand random numbers between 0 and 99?
> awk 'BEGIN{srand();for(i=0;i<1000;++i){print int(100*rand());}}'
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. randint_choose is such an
algorithm. Just don't ask me where I am going to get this source :)
Jim Meyering wrote:
> $ perl -le 'foreach (1..20) { print int rand 1000 }'
Ditto. I know, I know, it's not the kind of bias that is likely
to matter in practice, but why settle for less than perfect?
- Generating pseudo-random integers, Melikamp T. Medley, 2011/02/04
- Re: Generating pseudo-random integers, Eric Blake, 2011/02/04
- Re: Generating pseudo-random integers, Melikamp T. Medley, 2011/02/05
- Re: Generating pseudo-random integers, Bob Proulx, 2011/02/05
- Re: Generating pseudo-random integers,
Melikamp The Medley <=
- Re: Generating pseudo-random integers, Bob Proulx, 2011/02/05
- Message not available
- Message not available
- Re: Generating pseudo-random integers, Melikamp The Medley, 2011/02/05
- Re: Generating pseudo-random integers, Bob Proulx, 2011/02/05
- Re: Generating pseudo-random integers, Melikamp T. Medley, 2011/02/07
- Re: Generating pseudo-random integers, Jim Meyering, 2011/02/05
- Re: Generating pseudo-random integers, Pádraig Brady, 2011/02/05
- Re: Generating pseudo-random integers, Jim Meyering, 2011/02/05