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?