On changing rand(3) to random(3) in awk(1)
Chenguang Li
horus.li at gmail.com
Thu Sep 4 01:45:49 UTC 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
John Baldwin <jhb at 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-----
More information about the freebsd-hackers
mailing list