panicbit / quickcheck_derive

Derives quickcheck traits
Apache License 2.0
3 stars 3 forks source link

possible extension: probabilities for enum variants #2

Open llogiq opened 6 years ago

llogiq commented 6 years ago

We could allow #[P = 0.45] annotations to allow setting the probabilities for enum variants. The variants without annotations divide the remaining probability under themselves.

We should raise an error if the sum of probabilities is greater than 1.

tov commented 5 years ago

I came here to say this. Or almost this—I prefer integer weights (defaulting to 1) because I find it easier to adjust them independently. It wouldn't be difficult to support both.