module SecureRandom

Secure random number generator interface.

This library is an interface to secure random number generators which are suitable for generating session keys in HTTP cookies, etc.

You can use this library in your application by requiring it:

require 'securerandom'

It supports the following secure random number generators:

SecureRandom is extended by the Random::Formatter module which defines the following methods:

These methods are usable as class methods of SecureRandom such as SecureRandom.hex.

If a secure random number generator is not available, NotImplementedError is raised.

Constants

VERSION

The version

Public Class Methods

bytes(n) click to toggle source

Returns a random binary string containing size bytes.

See Random.bytes

# File lib/securerandom.rb, line 49
def bytes(n)
  return gen_random(n)
end