Ask for opinion: changing rand(3) to random(3) in awk(1)

Chenguang Li horus.li at gmail.com
Wed Aug 27 07:31:15 UTC 2014


-----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-----


More information about the freebsd-questions mailing list