module Bundler::Random::Formatter

def choose(source, n)

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

require 'bundler/vendor/securerandom/lib/random/formatter'

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

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

source array of characters.
Generate a string that randomly draws from a
def choose(source, n)
 source.size
= size
limit * size <= 0x100000000
t *= size
 1
 = ''.dup
m <= n
 random_number(limit)
 rs.digits(size)
s.length).times { is << 0 }
lt << source.values_at(*is).join('')
 m
 n
 random_number(limit)
 rs.digits(size)
s.length < n
-is.length).times { is << 0 }

.pop while n < is.length
lt.concat source.values_at(*is).join('')