Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Sep 2014 16:50:35 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Chenguang Li <horus.li@gmail.com>, delphij@freebsd.org, Vitaly Magerya <vmagerya@gmail.com>
Subject:   Re: On changing rand(3) to random(3) in awk(1)
Message-ID:  <11596842.yV7kvIp5At@ralph.baldwin.cx>
In-Reply-To: <97E2800A-1AC1-4595-872B-E4576D4B5FFB@gmail.com>
References:  <F70B9462-0898-47EF-AF83-47509F21F84E@gmail.com> <54003C42.1070309@gmail.com> <97E2800A-1AC1-4595-872B-E4576D4B5FFB@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, August 29, 2014 04:55:57 PM Chenguang Li wrote:
> Vitaly Magerya <vmagerya@gmail.com> wrote:
> > On 2014-08-29 10:12, Chenguang Li wrote:
> >> ... ...
> >> 
> >> Yes, I've noticed there's a fairness problem, 0 comes out more often.
> >> Since
> >> the original code is buggy too, do we need to be compatible with it?
> > 
> > I see no reason why we would.
> > 
> > Interestingly enough, GNU awk has this bug as well (and I am entirely
> > too lazy to report it).
> 
> Yes, I came across that line a few days ago. OSX's awk also has this bug,
> judging from their code[1]:
> 
>     u = (Awkfloat) (random() % RAND_MAX) / RAND_MAX;
> 
> >> Thanks for pointing that out, I've modified the gist as your suggestion.
> > 
> > Looks good to me. You might want to open a bug report with that patch,
> > as it's not clear if any committer is reading this thread.

Can you please open a bug report with the latest patch?

Xin Li (delphij@) imported the most recent awk version.  Ideally this patch 
would go upstream and not just be a local patch.  Perhaps Xin can help with 
that?

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11596842.yV7kvIp5At>