# File lib/crypt-isaac.rb, line 23 23: def initialize(noblock = true) 24: @mm = [] 25: @randrsl = [] 26: # Best initialization of the generator would be by pulling 27: # numbers from /dev/random. 28: rnd_source = noblock ? '/dev/urandom' : '/dev/random' 29: if (FileTest.exist? rnd_source) 30: File.open(rnd_source,'r') do |r| 31: 256.times do |t| 32: z = r.read(4) 33: x = z.unpack('V')[0] 34: @randrsl[t] = x 35: end 36: end 37: else 38: # If urandom isn't available, the standard Ruby PRNG makes an 39: # adequate fallback. 40: 256.times do |t| 41: @randrsl[t] = Kernel.rand(4294967295) 42: end 43: end 44: randinit(true) 45: nil 46: end