Date: Fri, 29 Aug 2014 16:55:57 +0800 From: Chenguang Li <horus.li@gmail.com> To: Vitaly Magerya <vmagerya@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: On changing rand(3) to random(3) in awk(1) Message-ID: <97E2800A-1AC1-4595-872B-E4576D4B5FFB@gmail.com> In-Reply-To: <54003C42.1070309@gmail.com> References: <F70B9462-0898-47EF-AF83-47509F21F84E@gmail.com> <53FEFBB8.5040305@gmail.com> <20140828131526.GA2385@straylight.m.ringlet.net> <5C40F611-22EB-49E4-8925-37922E771C0F@gmail.com> <53FF574E.1090108@gmail.com> <78248D53-D8B6-4135-B900-74E0047F92F1@gmail.com> <54003C42.1070309@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 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. I guess Peter (roam@) is one of the committers? [1] http://www.opensource.apple.com/source/awk/awk-18/src/run.c Chenguang Li -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJUAEAjAAoJELG4cS+11lRhJWcP/jo5UwRDrOrqJhatH8iZC4P0 XqaOZh35tAgNdzWKS9GtTirUVWcCNcIqN6VfqYLjTFBnXa1bKk2KntwzW2oCd86J Cl/JaMMaiIqoMGhG1D4i2rue73cl+XWhX8EiRN3BhcLLWkVdYGDzwKkTFzE4t35Y FxCfNhIr/05Ek6rsAsGiEgGIuOpztUL7QpYTrhaP/SmBD8ffdL56MdgxCryR9Z5c 321Rt14CAhlzYAlwjNL0KLetQDIufuCrUmlnsip0PeYXzzx0F/L4Uox9eBj0vPTW bg6IYTOKpYhtj2vgKqkK8iWMxOSpCqBIMd2WgfofVxKgWBRMb3FY1yHzrpiu4cb4 osAEfCLp9NCMArFQZB563yuM2PhhSSGw561JJhUNNtKv7kCMYeXFOdEGesggcOhK 8XS1qQHzymAzNlysNoBDD56KhNgMwLxLSxPZEWCqF/rLUwumQC+g5/OO/DXsD2pa 1ZnwEMIz1f6uLqdpTpB3plRfmKlikFrDc9F/yCZbOSXBO/w8iZeQucEjoe57HaXE jAbkCJfAoJtA8E+YwgZhaWJOwDOI2IUMrILfyE6T5VqHeTDeu/U+449ykiv+cU/4 uNJFc0sqI/+Ww/ZVjkruOiH056+IUM4jmaAMxQZ3XMG5pEQccLe/rqCyLcvzYTr3 9c7HvK6f0iUsgKCHcwgn =Pxqp -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?97E2800A-1AC1-4595-872B-E4576D4B5FFB>