parroty / excheck

Property-based testing library for Elixir (QuickCheck style).
MIT License
316 stars 26 forks source link

Generator for floating point value between two values #5

Closed ornamentist closed 9 years ago

ornamentist commented 10 years ago

I think the int/2 generator will generate an integer value between two integers? Could we have a matching real/2 generator that generates a float value between two floats?

Thanks!

parroty commented 10 years ago

Max value for int generators are using Erlang's :random.uniform, and doesn't have it for float values. One option could be divide int values by 10^x, or something?

http://erlang.org/doc/man/random.html#uniform-1

parroty commented 9 years ago

It may not be the best approach, but added an example for float case. I'm closing at the moment, but if you find any good approach please reopen or open another one.