Closed jonmeredith closed 5 years ago
You might want to consider a change to the method' name. In other pbt libraries (e.g. jqwik, scalacheck), frequency
is used to choose between instances of the type to generate.
In this case you want to choose between generators, similiar to what oneOf
is doing. That's why I suggest frequencyOf
as name. This would match jqwik's naming: https://jqwik.net/docs/current/user-guide.html#randomly-choosing-among-arbitraries
Introduces a new generator
frequency
that works similar tooneOf
, but each generator passed to it also gets a weight, and the resulting output is generated in proportion to the weights supplied.Also includes a version with no shrink point which is useful for generating command sequences.