How can I generate a random unicode string consisting of a given number of unicode characters in Ruby?
The following works, but includes control characters (0x00-0x1F, etc.) for instance:
20.times.map{ Random.rand(0xFFFF).chr('UTF-8')}.join
Aucun commentaire:
Enregistrer un commentaire