[Haskell-cafe] Annoyed at System.Random

Thomas DuBuisson thomas.dubuisson at gmail.com
Fri May 4 02:35:02 CEST 2012

On Thu, May 3, 2012 at 5:26 PM, Ertugrul Söylemez <es at ertes.de> wrote:
> Thomas DuBuisson <thomas.dubuisson at gmail.com> wrote:
>> I've grown annoyed at System.Random enough (specifically, StdGen).
>> How much, if any, pushback would there be if I put together a FFI
>> binding to a C AES-CTR based RNG.  There are many advantages:
>> [...]
>> I'd be tempted to pull in the 'entropy' package for seeding, but will
>> make that a separate proposal.
> Why reinvent the wheel?
>    <http://hackage.haskell.org/package/cprng-aes>
> Has both a System.Random and a Crypto-API interface.  As such it is
> already connected to the 'entropy' package.

Vincent has done great work for Haskell+Crypto so I think he knows I
mean nothing personal when I say cprng-aes has the right idea done the
wrong way.  Why a new effort vs Vincent's package?

1. cprng-aes is painfully slow.
2. It doesn't use NI instructions (or any C implementation, currently).
3. It isn't backtracking resistent.  I plan to follow the SP and test
against the KATs.
4. Lots of people still use "random" by default, so it would be good
to have StdGen be something reasonable, where "reasonable" is from as
many perspectives as we can manage.

This isn't to say that we could use much of the structure and
higher-level code that Vincent has already done.


> Greets,
> Ertugrul
> --
> nightmare = unsafePerformIO (getWrongWife >>= sex)
> http://ertes.de/
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list