Project

General

Profile

Actions

Feature #14052

open

Introduce SecureRandom.with_chars

Added by kyanagi (Kouhei Yanagita) over 6 years ago. Updated over 6 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:83557]

Description

ref. https://bugs.ruby-lang.org/issues/10849

This request renames SecureRandom.choose to .with_chars and makes it public.
(I think it would be a better name.)

For example, when generating passwords for users,
I'd like to avoid using characters "O" and "0" (or I, l, 1, ...) because they are confusing.
SecureRandom.with_chars would be useful to do this.


Files

securerandom-with_chars.diff (1.66 KB) securerandom-with_chars.diff kyanagi (Kouhei Yanagita), 10/25/2017 05:23 AM

Updated by matz (Yukihiro Matsumoto) over 6 years ago

I don't like the name with_chars. It doesn't describe the intention and the behavior of the method.

Matz.

Updated by mrkn (Kenta Murata) over 6 years ago

This function is called "sampling with replacement" in mathematics and statistics.

Updated by knu (Akinori MUSHA) over 6 years ago

I'd vote for SecureRandom.random_chars(len=16, candidate_chars).

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0