chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Patch to use better PRNG on BSD's


From: Peter Bex
Subject: Re: [Chicken-hackers] Patch to use better PRNG on BSD's
Date: Tue, 10 Apr 2012 22:18:32 +0200
User-agent: Mutt/1.4.2.3i

On Tue, Apr 10, 2012 at 07:15:44PM +0300, Timo Myyrä wrote:
> I noticed that chicken uses old rand / srand functions when better
> alternatives are present.
> Patch makes BSD's use arc4random instead of rand.

NetBSD doesn't have arc4random_uniform either, so that'd need to be added
to the test.

I think a cleaner and more robust way is to actually put a PRNG inside
Chicken itself.  That way all platforms benefit from a good random
generator instead of it being a hit-and-miss situation.  Chicken ought
to provide as good an abstraction over nasty annoying OS details as it
can.

Having said that, your patch is an unmistakable improvement over the
current situation, especially on MacOS X, assuming they bothered to
implement arc4random properly this time...

> I'm not 100% sure this is correct so test, at least the Mac OS X part
> as it doesn't have arc4random_uniform() function.
> Builds and seems to work OK on OpenBSD when applied to 4.7.0 version.

Your patch got mangled somewhere along the way.  I think it might be the
mailinglist software at nongnu.org that did that.  Please put patches in
your mail as a separate attachment instead of inlining them.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth



reply via email to

[Prev in Thread] Current Thread [Next in Thread]