nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
717 stars 119 forks source link

Subrandom numbers #165

Open edmundnoble opened 7 years ago

edmundnoble commented 7 years ago

I was surfing Wikipedia one night when I came across the page on low-discrepancy sequences, or subrandom numbers. These are sequences designed to cover the maximum "area" possible in a given range. They appear to be useful in situations which don't require randomness as much as they require even spacing between numbers, like quasi-Monte Carlo simulations.

This prompted me to wonder what it is exactly about random numbers that makes them suited for generating test data. Random numbers are prone to clustering and gaps, in a way which seems, to me, to be disadvantageous for property-based testing. Despite this, I asked around, and I wasn't able to find a case of subrandom numbers being used for property-based testing. Is this something anyone here has tried? Is it worth adding to property-based testing libraries? It should require fairly few changes for monadic varieties.

matthiasgoergens commented 7 years ago

You might like The Discrepancy Method - Randomness and Complexity. Random numbers are great, also because they are very robust.

For example, it's obvious how to make a pair of random numbers that is still nicely distributed. How do you ensure that a pair drawn from low discrepancy sequences is still nicely distributed, and not highly correlated? (I am sure you can parameterize your sequences somehow---just like we split random numbers. But it is a complication.)