From owner-freebsd-questions@FreeBSD.ORG Wed Aug 27 07:31:15 2014 Return-Path: Delivered-To: freebsd-questions@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 1A469F0E for ; Wed, 27 Aug 2014 07:31:15 +0000 (UTC) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (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 E5D7D3DBF for ; Wed, 27 Aug 2014 07:31:14 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id eu11so25105918pac.18 for ; Wed, 27 Aug 2014 00:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=NqsihLZY7hpk/V69Wnfm4qrFTrIvqmuTJekFyAw4gdU=; b=I1+A8FGs8/ZlL9CT48DQFY700a5RQTMOMksgFtR5K5VBOmy+xm05QMmxHLAvS8sH1y pcx+aAS+wjJkOjdP1ME1SOX9gaGIX46WqdUGNuScenie9lfrNnghBq46YzMLVE6DewCj 0NE6bLF7BWUgEbet7Ivi0Fh6MZ71xOwvoy+BApKMwEGEd/B4Q9ToKB1H27AaP4zf3nYu jKddEt/Kyh/q3amYn2BPf/VVt19R2s2zypj2okbJwqmrhhl/zpTBHUuRf1aVI+qN7wxH BdMQBNu1xS9TsV2+j6gXf7RTollxX35kdjddGCprzAbRnZf6XSShQxnPJ5GH0RtVJ1zb yYAQ== X-Received: by 10.70.40.227 with SMTP id a3mr43497404pdl.36.1409124671728; Wed, 27 Aug 2014 00:31:11 -0700 (PDT) Received: from [127.0.0.1] ([202.55.17.37]) by mx.google.com with ESMTPSA id dg5sm18411876pac.12.2014.08.27.00.31.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 00:31:11 -0700 (PDT) From: Chenguang Li Content-Type: text/plain; charset="utf8"; Content-Transfer-Encoding: 8bit X-Pgp-Agent: GPGMail (null) Subject: Ask for opinion: changing rand(3) to random(3) in awk(1) Message-Id: Date: Wed, 27 Aug 2014 15:30:56 +0800 To: freebsd-questions@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Aug 2014 07:31:15 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi guys, After encountering the same problem posted here[1] (awk's rand() not "random" enough), I did some research. It[2] shows that awk(1) in OSX is currently using random(3) instead of rand(3), the same in gawk(1). Changing rand(3) to random(3) only requires modifying a few lines of code, but will result in better random number generation. So why not? :) [1] https://forums.freebsd.org/viewtopic.php?&t=6456 [2] http://www.opensource.apple.com/source/awk/awk-18/src/run.c - --- Chenguang Li -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJT/YkwAAoJELG4cS+11lRhocUP/0+n4I2SYNZ45VQOfWkgZZhu Wqx4zG273ddkvfZs4nXpvTLJDlHz0PLQXF/hbi8/RH4gcaOubAF0wTZz5zAkpczN JdK1WSi9yFpb6U8dsVJaeay7CxUrv+kBUKzWz92Fg1YH9ZsGskbTYsFJUqH2TiwL OzOvRDUodxGb5NPcCnys9c2Cb0v5/nffwnanDiRXsVyyYrVAr/ALmY5qSue4OoeY PL7u56jYpX98YuPVCDTrRtVZaPkaNVyduVUWLYTRaMjyu5TbN3yhE29HssvXBFsD wK7p3slC8o3aAdopmxv8ne4NI+OkKU4ukxhuDAr1jcIy+Uhmxz+2ZJmjrSTEr+Ff 5K1/WFCWx9c9XLDSHQFJKkouRDLJSHQJxZVostDrBIz9cXqtWWafesf4VvEzWMwx 41Aq5AAVDpQMjaymLaHF11hdyhzVHzS2G2rkn6BLtM32baJJZk8XP0PZp7o11ldJ l7xZnLQ7L4sFCyBwZx2PHLed52SKBSzMhj9ejVf+NICeTk3ZlQP2c2ZGbu87rghH YJTC/1PTV5vufaPE5P644o/r4t3PSdLo4s+ngdv946NggV8JSBxkP6FcjTXiwSMn VEphdAI3Luk7F1IIBhDywYbDe6LkiJ+tGfN1gDpcNGcciYU1E/0noCIoAJyn3h6s QbQ7hRf6iARh2YzA16t1 =It9Y -----END PGP SIGNATURE-----