Ask for opinion: changing rand(3) to random(3) in awk(1)
freebsd-questions-local at be-well.ilk.org
Wed Aug 27 19:59:15 UTC 2014
Chenguang Li <horus.li at gmail.com> writes:
> Hi guys,
> After encountering the same problem posted here (awk's rand() not
> "random" enough), I did some research. It 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? :)
>  https://forums.freebsd.org/viewtopic.php?&t=6456
>  http://www.opensource.apple.com/source/awk/awk-18/src/run.c
I had thought about that a few years ago, but I didn't have any cases
where it mattered. Note that your example (footnote 1) is *not* such a
case. The bug in that case is calling srand() multiple times, rather
than just once at the beginning.
You could take a patch to the security or hackers list, but first you
should figure out what problem you are trying to solve.
More information about the freebsd-questions