Skip to content

Conversation

non
Copy link
Contributor

@non non commented May 9, 2020

This commit adds support for several statistical distributions:

  • Gaussian (normal)
  • Exponential
  • Geometric
  • Poisson
  • Binomial

These distributions are likely to be useful for writing generators, as
well as for fine-grained control of numerical ranges.

Currently, authors using Gen.choose have to decide whether to forbid
testing with large Double values (by using a small range), or to allow
large values (in which case their test will be dominated by large
values). One solution is to use distributions where large values are
possible but rare, such as an exponential distribution.

Similarly, authors can use a geometric distribution to generate the
size of a collection which is usually small, but may occasionally be
large.

This commit adds support for several statistical distributions:

 - Gaussian (normal)
 - Exponential
 - Geometric
 - Poisson
 - Binomial

These distributions are likely to be useful for writing generators, as
well as for fine-grained control of numerical ranges.

Currently, authors using Gen.choose have to decide whether to forbid
testing with large Double values (by using a small range), or to allow
large values (in which case their test will be dominated by large
values). One solution is to use distributions where large values are
possible but rare, such as an exponential distribution.

Similarly, authors can use a geometric distribution to generate the
size of a collection which is usually small, but may occasionally be
large.
@non non requested a review from ashawley May 9, 2020 03:56
@ashawley
Copy link
Contributor

Very cool! 👍

@non non merged commit 7ef09b6 into typelevel:master May 13, 2020
@non non deleted the topic/stats branch May 13, 2020 19:30
@ashawley ashawley added this to the 1.15.0 milestone Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants