Feature #4938

Add Random.bytes [patch]

Added by marcandre (Marc-Andre Lafortune) over 6 years ago. Updated almost 3 years ago.

Target version:


It could be useful to add a Random.bytes method (equivalent to Random::DEFAULT.bytes), as per the simple patch attached.

randombytes.diff (2.19 KB) randombytes.diff marcandre (Marc-Andre Lafortune), 06/28/2011 12:58 AM
randombytes-ruby22.diff (2.38 KB) randombytes-ruby22.diff hsbt (Hiroshi SHIBATA), 10/29/2014 05:37 AM


#1 Updated by shyouhei (Shyouhei Urabe) over 5 years ago

  • Status changed from Open to Assigned

#2 [ruby-core:49243] Updated by marcandre (Marc-Andre Lafortune) almost 5 years ago

Comment about this trivial feature would be appreciated.

#3 [ruby-core:49248] Updated by mrkn (Kenta Murata) almost 5 years ago

  • Target version changed from 2.0.0 to next minor

I think it is useful and acceptable to introduce, but 2.0 is already frozen about its features, so the target version should be next-minor.

#4 [ruby-core:65670] Updated by hsbt (Hiroshi SHIBATA) about 3 years ago

  • File randombytes-ruby22.diff added

I update this patch on Ruby 2.2.

#5 [ruby-core:65974] Updated by marcandre (Marc-Andre Lafortune) almost 3 years ago

Hi Nobu,
is there a reason not to commit this?

#6 [ruby-core:65976] Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Assignee changed from nobu (Nobuyoshi Nakada) to normalperson (Eric Wong)

I think there is no problems.

#7 [ruby-core:65978] Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago

  • File deleted (randombytes-ruby22.diff)

#9 [ruby-core:65982] Updated by normalperson (Eric Wong) almost 3 years ago wrote:

File randombytes-ruby22.diff added

Looks good to me.
Any approval from matz since this is a new API?

#10 [ruby-core:66057] Updated by normalperson (Eric Wong) almost 3 years ago

  • Assignee changed from normalperson (Eric Wong) to matz (Yukihiro Matsumoto)

Any comment from matz for API addition?

Also available in: Atom PDF