Random number generator (device): Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: added specifying RNG example)
Line 1,244: Line 1,244:
Ruby 1.8.7 introduces the 'securerandom' library. For [[MRI]] users, this library tries to get random numbers by loading OpenSSL, or opening /dev/urandom, or calling CryptGenRandom.
Ruby 1.8.7 introduces the 'securerandom' library. For [[MRI]] users, this library tries to get random numbers by loading OpenSSL, or opening /dev/urandom, or calling CryptGenRandom.


{{works with|Ruby|1.8.7}}
<lang Ruby>require 'securerandom'
<lang Ruby>require 'securerandom'
SecureRandom.random_number(1 << 32)
SecureRandom.random_number(1 << 32)