jruby

https://github.com/jruby/jruby

Ruby

JRuby, an implementation of Ruby on the JVM

Random::Formatter#choose

SecureRandom.choose generates a string that randomly draws from a
source array of characters.

The argument _source_ specifies the array of characters from which
to generate the string.
The argument _n_ specifies the length, in characters, of the string to be
generated.

The result may contain whatever characters are in the source array.

  p SecureRandom.choose([*'l'..'r']) #=> "lmrqpoonmmlqlron"
  p SecureRandom.choose([*'0'..'9'], 5) #=> "27309"

If a secure random number generator is not available,
+NotImplementedError+ is raised.

Source | Google | Stack overflow

Edit

git clone [email protected]:jruby/jruby.git

cd jruby

open lib/ruby/stdlib/securerandom.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Random--Formatter-choose-for-pr


# Commit to git

git add lib/ruby/stdlib/securerandom.rbgit commit -m "better docs for Random::Formatter#choose"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Random--Formatter-choose-for-pr

hub pull-request


# Celebrate!