diff --git a/lib/resolv.rb b/lib/resolv.rb index 0574ce6..fc14aa9 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -3,11 +3,7 @@ require 'socket' require 'timeout' require 'io/wait' - -begin - require 'securerandom' -rescue LoadError -end +require 'securerandom' # Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can # handle multiple DNS requests concurrently without blocking the entire Ruby @@ -613,16 +609,10 @@ def extract_resources(msg, name, typeclass) # :nodoc: } end - if defined? SecureRandom - def self.random(arg) # :nodoc: - begin - SecureRandom.random_number(arg) - rescue NotImplementedError - rand(arg) - end - end - else - def self.random(arg) # :nodoc: + def self.random(arg) # :nodoc: + begin + SecureRandom.random_number(arg) + rescue NotImplementedError rand(arg) end end