summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-12-14 00:55:02 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-12-14 11:59:22 +0900
commit900e0c8c39fe3df72d7ce451e01c1add7b6f1647 (patch)
tree43917f770ee56f6d07707677ea2ccffc508775fa /lib
parent0ebbab23bab7f039a9c28c519392b78d69a0e901 (diff)
[ruby/securerandom] Use String#unpack1
https://github.com/ruby/securerandom/commit/5460a18c35
Diffstat (limited to 'lib')
-rw-r--r--lib/random/formatter.rb2
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.