Flowdock
method

gen_random

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: SecureRandom
gen_random(n) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/securerandom.rb, line 53
    def gen_random(n)
      ret = Random.urandom(1)
      if ret.nil?
        begin
          require 'openssl'
        rescue NoMethodError
          raise NotImplementedError, "No random device"
        else
          @rng_chooser.synchronize do
            class << self
              remove_method :gen_random
              alias gen_random gen_random_openssl
            end
          end
          return gen_random(n)
        end
      else
        @rng_chooser.synchronize do
          class << self
            remove_method :gen_random
            alias gen_random gen_random_urandom
          end
        end
        return gen_random(n)
      end
    end
Register or log in to add new notes.