[erlang-questions] Multi-precision math, random number generator entropy, various other questions

Will wglozer@REDACTED
Sun May 31 23:45:22 CEST 2009


On Sun, May 31, 2009 at 2:04 PM, Per Hedeland <per@REDACTED> wrote:
>
> But anyway, I think the best answer was already given - use
> crypto:rand_bytes/1 if you really need "crypto quality" random numbers.
> The OpenSSL crypto library will use /dev/urandom and the like (depending
> on availability) to seed a high-quality PRNG - i.e. you get something
> that is a) portable and b) probably the best quality you *can* get on a
> given OS/HW.

FYI, crypto:rand_bytes/1 calls OpenSSL's RAND_pseudo_bytes() function.

  http://openssl.org/docs/crypto/RAND_bytes.html.

The Description section of the man page indicates that the output is not
cryptographically strong. However the Return Values section says the
output is strong when the return value is 1.  In any case, crypto_drv.c
doesn't appear to check the return value.

-Will


More information about the erlang-questions mailing list