Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 09:45:25 +0800
From:      Chenguang Li <horus.li@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, d@delphij.net, Vitaly Magerya <vmagerya@gmail.com>, Erik Cederstrand <erik@cederstrand.dk>
Subject:   Re: On changing rand(3) to random(3) in awk(1)
Message-ID:  <480C9391-4E1F-4E54-888F-419B7B6A0E24@gmail.com>
In-Reply-To: <11596842.yV7kvIp5At@ralph.baldwin.cx>
References:  <F70B9462-0898-47EF-AF83-47509F21F84E@gmail.com> <54003C42.1070309@gmail.com> <97E2800A-1AC1-4595-872B-E4576D4B5FFB@gmail.com> <11596842.yV7kvIp5At@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

John Baldwin <jhb@freebsd.org> wrote:

> [omitted] 
>
> 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?

Sorry for not keeping you guys updated, actually I did open a bug report[1] a
few days ago. I also wrote Brian Kernighan an email with details and a link to
this thread then, as Erik suggested. He replied:

> I've read the thread on rand vs random; it's interesting.
> It sounds like replacing rand with random would be a good
> idea regardless, and probably it's good to replace the
> RAND_MAX with an explicit 2^31+1.
> 
> I don't think that it would hurt to also use RAND_MAX+1UL
> with rand() as an interim measure.  You're right that zero
> does come up twice as often as any other value.  Probably
> doesn't make much difference in practice, but better to do
> things right when possible.
> 
> I'll add this to my list of things to try to fix up, which
> is getting longer than it should, but I've been busy on
> other things and keep pushing awk over the horizon.

So I guess this would eventually be patched upstream.

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193147

Chenguang Li

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJUB8REAAoJELG4cS+11lRhrPcQAK5nH6ZozdeMPzl9LfLn2PAM
NHhq0G/yaAihNSYqmhQSW7W3ZbNtQ1HTTqsDSgh+rnk1WEgUkyHZARdhnywElnwF
AXldYw0CJTJCL4aN6SeX9Wt34M4DJvaXAsvG+YaMUsicaho+cUEUW7m+b+YkAAUI
G1JqaImvT0crYWTewS7nVvpqiyWw7bL7mS+v/B6zY7Fh8yCxWomc+7ZC5Q837vic
cBUqCZG2bpZpOb0lvRnSIeDLhlHx8L4HOXuXMWUD/O7OGNehdYqBiaEIASAmT/ar
sKa2kDb3DTrJ+AGZh9keDoLWHhcZA9EtFREdTqdDlm+V2QyyzpEDbwFZHnt9KoPI
HzP4JuJuIG4+iSIarZ8WLje8jy5D+Us6JVz1e6oc/7ZetDR3w27Qzb6pcvGgloFI
OuYksTi+TxlGYQqQlqL4JIuvCPC87gT0AKNpuJxAzAajCCaoMRDvwQyCI4wqsrQ9
e9IOlNRtqERRBifL/Vq/MJNgHPus6l2PEs4GZgEf+BA30Lbq+k2bvLHvtORO19s6
kCu/zebnmPX4JNKFB99zOHUOFTmQv5QkG0AstmcxWeR6IDpBmuGe/ejLzDtU8iWT
cg6oPtk+/JytooNYjm1ADz6pxwab1Q71rVXCUQQFWG8cIR1LIrGeeEJguzXP9nAL
9GOF7XQnTwGTFj4wuga0
=sBDJ
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?480C9391-4E1F-4E54-888F-419B7B6A0E24>