class SecureYOLORNG

Public Class Methods

rand(max=nil) click to toggle source

Return a random integer

Example:

>> SecureYOLORNG.rand
=> 1263245525397660367831872 # Hey! That IS totally random!

>> SecureYOLORNG.rand 10
=> 9

Arguments:

max: (Integer)
# File lib/syolorng.rb, line 18
def self.rand(max=nil)
  case max
  when nil
    random
  else
    random % max
  end
end

Private Class Methods

random() click to toggle source
# File lib/syolorng.rb, line 29
def self.random
  Digest::SHA512.hexdigest(DateTime::now.to_s).to_i(16)
end