Created
August 9, 2011 12:20
-
-
Save rishav/1133897 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> ActiveSupport::SecureRandom.base64(10) | |
=> "Fa8ILYFgMA12LA==" | |
>> ActiveSupport::SecureRandom.hex(6) | |
=> "82c82a15110a" | |
>> ActiveSupport::SecureRandom.random_bytes(16) | |
=> "u[\205\326\2654\301;'\340\372\2539r\035\313" | |
>> ActiveSupport::SecureRandom.random_number(5) | |
=> 0 |
And thanks for letting me know, I probably wouldn't have factored this in until I encountered it somewhere :).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You generally don't see the blocking on regular working machines (desktops, busy servers that r/w things all the time, etc.). I've surely had several blockages over with Hadoop when it used SecureRandom generation. As the name goes, its only to be used when you really require that level of randomness (crypto purposes mostly) :)
Anyhow, not sure what ruby's impl may be but if your system entropy pool's dry - its gonna block, that's all I was trying to say :-)