lib/queencheck/string.rb in queencheck-0.0.0 vs lib/queencheck/string.rb in queencheck-0.0.1
- old
+ new
@@ -29,12 +29,18 @@
charset += (0x80 ... 0x800).to_a
charset += (0x800 ... 0x8000).to_a
charset += (0x1000 ... 0x20000).to_a
end
+ if !charset.respond_to?(:sample)
+ class << charset
+ def sample; self[rand(self.length)]; end
+ end
+ end
+
ret = []
(rand(max/2) + (max/2)).times do
- ret << charset[rand(charset.length)]
+ ret << charset.sample
end
return ret.pack('U*')
end
end