In article <
6fff5276-1533-4966...@googlegroups.com>,
Andrew Schorr <
asc...@telemetry-investments.com> wrote:
>Hi,
Indeed. Hello.
>A couple of thoughts. First, the master branch, which eventually should be
>released as 4.2, has a revised rand() function that is designed to give "more
>random" results.
Good to hear.
>Second, the gawk rand() function actually uses the C library
>random() function, not rand().
Yes, understood. From the O.P.:
* Note that gawk uses "random()", which is
* supposed to be better than "rand()", but still doesn't look very good to
* me.
>FWIW. Here are some results using the master branch:
>
>bash-4.3$ echo "100 6" | ./gawk 'BEGIN {srand()} { for (i=1; i<=$1; i++)
>x[int(rand()*$2)]++;for (i in x) print i,x[i];delete x}'
>0 21
>1 16
>2 18
>3 14
>4 15
>5 16
This does look better. Looking forward to it!
>P.S. Your original sample size of 10 strikes me as quite small.
Intentionally so. Where this is all coming from is that I'm using a random
number to pick one of a small number of strings to print. The total number
of possible strings is about 10 and the number of picks is also about 10.
I've noticed in practice that the program almost always prints the same
string multiple times and skips many of them in any given run. This
obviously makes the output look like sensible.
--
The key difference between faith and science is that in science, evidence that
doesn't fit the theory tends to weaken the theory (that is, make it less likely to be
believed), whereas in faith, contrary evidence just makes faith stronger (on the
assumption that Satan is testing you - trying to make you abandon your faith).