Feature #4938

Add Random.bytes [patch]

Added by Marc-Andre Lafortune about 5 years ago. Updated over 1 year ago.



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

randombytes.diff View (2.19 KB) Marc-Andre Lafortune, 06/28/2011 12:58 AM

randombytes-ruby22.diff View (2.38 KB) Hiroshi SHIBATA, 10/29/2014 05:37 AM


#1 Updated by Shyouhei Urabe over 4 years ago

  • Status changed from Open to Assigned

#2 [ruby-core:49243] Updated by Marc-Andre Lafortune over 3 years ago

Comment about this trivial feature would be appreciated.

#3 [ruby-core:49248] Updated by Kenta Murata over 3 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 Hiroshi SHIBATA almost 2 years ago

  • File randombytes-ruby22.diff added

I update this patch on Ruby 2.2.

#5 [ruby-core:65974] Updated by Marc-Andre Lafortune almost 2 years ago

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

#6 [ruby-core:65976] Updated by Nobuyoshi Nakada almost 2 years ago

  • Assignee changed from Nobuyoshi Nakada to Eric Wong

I think there is no problems.

#7 [ruby-core:65978] Updated by Hiroshi SHIBATA almost 2 years ago

  • File deleted (randombytes-ruby22.diff)

#8 [ruby-core:65980] Updated by Hiroshi SHIBATA almost 2 years ago

I revised patch for Ruby 2.2.

#9 [ruby-core:65982] Updated by Eric Wong almost 2 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 Eric Wong over 1 year ago

  • Assignee changed from Eric Wong to Yukihiro Matsumoto

Any comment from matz for API addition?

Also available in: Atom PDF