[ruby-core:114569] [Ruby master Feature#19854] Make SecureRandom.choose public

Issue #19854 has been reported by p8 (Petrik de Heus). ---------------------------------------- Feature #19854: Make SecureRandom.choose public https://bugs.ruby-lang.org/issues/19854 * Author: p8 (Petrik de Heus) * Status: Open * Priority: Normal ---------------------------------------- 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: ```ruby 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... -- https://bugs.ruby-lang.org/
participants (1)
-
p8 (Petrik de Heus)