Closed romanb closed 5 years ago
@romanb Would you might rebasing this? I took care of the rand/rand_core upgrade and the MSRV tweak in separate commits.
@BurntSushi Done. Since the MSRV is now 1.30, I could also remove the conditional compilation for the Nevermind, you did that already!i128
feature as part of this PR, if desired.
This is supposed to address both #119 and #190 by interpreting the generator's size parameter as a bias towards the induced range, instead of as a hard limit. Specifically:
In accordance with intuition, lowering the size parameter increases the probability of smaller numbers and increasing the size parameter increases the probability of larger numbers being generated.
The distribution could be further refined but I was trying to keep it simple while solving the main problem of sampling from the entire range such that the influence of the generator's
size
is easily described and understood. Here are some sample distributions with size=100 (the default size).Further comments:
Because I expanded the tests a little and also wanted to cover
i128
/u128
, I bumped the dependencies onrand
andrand_core
to0.6
and0.3
, respectively, requiring a few minor modifications.Because the latest version of the transitive dependency
lazy_static
has a lower bound for rustc >= 1.24.1 I bumped the lower bound for quickcheck accordingly. If you are willing to go up to1.26
, the feature gate fori128
could be removed, as it stabilised in that release. Would that be desirable?The
assert!
s serve only to state the established invariants and could be removed or turned into comments, if desired.