Sha256: 99fd0f5d76a857643d1d9de8aea0e19c84a738eaa791abd08f014b255da0fb38

Contents?: true

Size: 288 Bytes

Versions: 2

Compression:

Stored size: 288 Bytes

Contents

module RandomText
  class RandomStrings < Array
    def get(count = nil)
      count ? Array.new(count){ rand } : rand
    end

    def uniq(n)
      raise "Dictionary has only #{length} elements (you asked for n)" if n > length
      sort_by{ Kernel.rand }.slice(0, n)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
random_text-0.0.3 lib/random_text/random_strings.rb
random_text-0.0.5 lib/random_text/random_strings.rb