[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108777] [Ruby master Feature#18817] SecureRandom::choose is not being exposed
From:
"mame (Yusuke Endoh)" <noreply@...>
Date:
2022-06-06 03:22:32 UTC
List:
ruby-core #108777
Issue #18817 has been updated by mame (Yusuke Endoh).
Status changed from Open to Rejected
"choose" is named just for an internal API. We need another good name if we make it public. Continue to discuss in #18183.
----------------------------------------
Feature #18817: SecureRandom::choose is not being exposed
https://bugs.ruby-lang.org/issues/18817#change-97842
* Author: midnight (Sarun R)
* Status: Rejected
* Priority: Normal
----------------------------------------
I read through [the doc of `SecureRandom`](https://ruby-doc.org/stdlib-3.1.2/libdoc/securerandom/rdoc/SecureRandom.html) and found that it has the `choose` method.
So, I spin up `irb` for a quick test.
~~~
> ::SecureRandom.choose([*('0'..'9'), *('A'..'Z')], 25)
(irb):47:in `<main>': private method `choose' called for SecureRandom:Module (NoMethodError)
::SecureRandom.choose([*('0'..'9'), *('A'..'Z')], 25)
^^^^^^^
~~~
The method is marked as private. So, I forcefully call the method with success.
~~~
> ::SecureRandom.send(:choose, [*('0'..'9'), *('A'..'Z')], 25)
=> "5FHY5PXLT184GIVISCVESTMGO"
~~~
I did not test for uniformity of the randomness, though.
I wonder why the method has been marked as private?
Is it not ready for production uses?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>