From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 4 01:45:49 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D363A42; Thu, 4 Sep 2014 01:45:49 +0000 (UTC) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A9E51733; Thu, 4 Sep 2014 01:45:49 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id r10so12409521pdi.36 for ; Wed, 03 Sep 2014 18:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yHLL1RTU7WsiqbtuTZpOPznQacFpqkHAetOP+DFQKP4=; b=Lq4zpwmtBImiKXLXqV8TFq+5SxVh0FJp4wrFfXAuQCMfdeJ7DaH7fQlBtC+LgDJ7KD r38lToR2he0exH2tHQGMTE008KHDUTokeloz7bOKkyqujUeAFNrTthTuOZ+qFKJ45S6k tjUsSxgWR4k00ME0RlMToh29kI1thN4opVUFBL2Kro+I0ygcymFksrc0HbZKTmPjavPi bF+uTxkkDCqNopsRhXYKDLo3GgS+y73qr3/8qbnhggBVDMIVEVNt6guNuNNBjvZfO1DH +p3rCnUN/zbiXEojGqmCzUPkLe0xL4svF2v18bhxzI5aECLiyxd+pEp5ogRc3LJe0c4u 8rXQ== X-Received: by 10.66.65.230 with SMTP id a6mr2651550pat.18.1409795148166; Wed, 03 Sep 2014 18:45:48 -0700 (PDT) Received: from [10.240.140.110] ([123.58.191.69]) by mx.google.com with ESMTPSA id n7sm164080pdm.35.2014.09.03.18.45.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 18:45:47 -0700 (PDT) Content-Type: text/plain; charset="utf8"; Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: On changing rand(3) to random(3) in awk(1) X-Pgp-Agent: GPGMail (null) From: Chenguang Li In-Reply-To: <11596842.yV7kvIp5At@ralph.baldwin.cx> Date: Thu, 4 Sep 2014 09:45:25 +0800 Content-Transfer-Encoding: 8bit Message-Id: <480C9391-4E1F-4E54-888F-419B7B6A0E24@gmail.com> References: <54003C42.1070309@gmail.com> <97E2800A-1AC1-4595-872B-E4576D4B5FFB@gmail.com> <11596842.yV7kvIp5At@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: freebsd-hackers@freebsd.org, d@delphij.net, Vitaly Magerya , Erik Cederstrand X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2014 01:45:49 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 John Baldwin 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-----