Module: SecureRandom

Defined in:
lib/use_urandom.rb

Constant Summary collapse

URANDOM =

A constant for the file path used

"/dev/urandom"

Class Method Summary collapse

Class Method Details

.gen_random(n) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/use_urandom.rb', line 11

def gen_random(n)
  begin
    UseUrandom.urandom(n)
  rescue
    # Fallback code - UseRandom raises exceptions on any problem
    warn "Using original SecureRandom"
    original_gen_random(n)
  end
end

.original_gen_randomObject



9
# File 'lib/use_urandom.rb', line 9

alias_method :original_gen_random, :gen_random