Skip to content

Instantly share code, notes, and snippets.

@rishav
Created August 9, 2011 12:20
Show Gist options
  • Select an option

  • Save rishav/1133897 to your computer and use it in GitHub Desktop.

Select an option

Save rishav/1133897 to your computer and use it in GitHub Desktop.
>> 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
@rishav
Copy link
Copy Markdown
Author

rishav commented Sep 4, 2011

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