diff options
Diffstat (limited to 'lib/securerandom.rb')
-rw-r--r-- | lib/securerandom.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb index 5440dbaad9..a0f7b13da8 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -119,6 +119,10 @@ module SecureRandom return OpenSSL::Random.random_bytes(n) end + if defined?(AdvApi32) + return AdvApi32.gen_random(n) + end + if !defined?(@has_urandom) || @has_urandom flags = File::RDONLY flags |= File::NONBLOCK if defined? File::NONBLOCK @@ -140,10 +144,6 @@ module SecureRandom end end - if defined?(AdvApi32) - return AdvApi32.gen_random(n) - end - raise NotImplementedError, "No random device" end |