Method: PropCheck::Generators.char
- Defined in:
- lib/prop_check/generators.rb
.char ⇒ Object
Generates a single unicode character (both printable and non-printable).
Shrinks towards characters with lower codepoints, e.g. ASCII
>> Generators.printable_char.sample(size: 10, rng: Random.new(42))
=> ["吏", "", "", "", "", "", "", "", "", "Ȍ"]
625 626 627 628 629 |
# File 'lib/prop_check/generators.rb', line 625 def char choose(0..0x10FFFF).map do |num| [num].pack('U') end end |