diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-12-14 00:55:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-12-14 11:59:22 +0900 |
commit | 900e0c8c39fe3df72d7ce451e01c1add7b6f1647 (patch) | |
tree | 43917f770ee56f6d07707677ea2ccffc508775fa /lib/random | |
parent | 0ebbab23bab7f039a9c28c519392b78d69a0e901 (diff) |
[ruby/securerandom] Use String#unpack1
https://github.com/ruby/securerandom/commit/5460a18c35
Diffstat (limited to 'lib/random')
-rw-r--r-- | lib/random/formatter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/random/formatter.rb b/lib/random/formatter.rb index d7e7b1f77a..744853a4b7 100644 --- a/lib/random/formatter.rb +++ b/lib/random/formatter.rb @@ -71,7 +71,7 @@ module Random::Formatter # prng.hex #=> "eb693ec8252cd630102fd0d0fb7c3485" # prng.hex #=> "91dc3bfb4de5b11d029d376634589b61" def hex(n=nil) - random_bytes(n).unpack("H*")[0] + random_bytes(n).unpack1("H*") end # Random::Formatter#base64 generates a random base64 string. |