Sha256: 86d2ebd98f3d651436442d136da36f042c1c65dbf47b93059f0c08d752baab36
Contents?: true
Size: 480 Bytes
Versions: 6
Compression:
Stored size: 480 Bytes
Contents
module RandomText class RandomStrings < Array def get(count = nil) case count when :all to_a.sort_by{ Kernel.rand } when Integer Array.new(count){ rand } else rand end end def uniq(count) case count when :all get(:all) when Integer raise "Dictionary has only #{length} elements (you asked for n)" if count > length get(:all).slice(0, count) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems