Actions
Feature #19854
closedMake SecureRandom.choose public
Status:
Closed
Assignee:
-
Target version:
-
Description
SecureRandom implements the choose method that randomly draws from a source array of characters.
This method is currently private, but it could be useful as a public method.
For example for generating a pin number:
SecureRandom.choose((0..9).to_a, 6)
Another example is Rails, which implements SecureRandom.base36
and SecureRandom.base58
.
These implementations would be a lot simpler (and faster for base36) by replacing it with choose
:
https://github.com/rails/rails/blob/735cba5bed7a54c7397dfeec1bed16033ae286f8/activesupport/lib/active_support/core_ext/securerandom.rb
Updated by mame (Yusuke Endoh) over 1 year ago
- Is duplicate of Feature #18183: make SecureRandom.choose public added
Updated by hsbt (Hiroshi SHIBATA) over 1 year ago
- Status changed from Open to Closed
Actions
Like0
Like0Like0