-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rand optional #275
Make rand optional #275
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #275 +/- ##
==========================================
+ Coverage 93.54% 93.70% +0.16%
==========================================
Files 53 53
Lines 11657 11636 -21
==========================================
Hits 10904 10904
+ Misses 753 732 -21 ☔ View full report in Codecov by Sentry. |
Thanks again for what you've put in with the last 24 hours. It looks good, just gotta handle the merge. |
161662d
to
5ae4760
Compare
This should be good to go. I resolved the merge conflicts manually, and the CI failure is just codecov |
This changes the behavior of Cauchy::mean() and Cauchy::variance() from the old default implementation (based on RNG sampling) to simply returning `None`. Both mean and variance are undefined for the cauchy distribution. This also changes the trait signature of both Distribution<T> and DiscreteDistribution<T> to not be subtraits of rand::distribution::Distribution<T>. Our distributions do still implement this trait iff the `rand` feature is enabled.
5ae4760
to
35c5dd0
Compare
Needed to rebase again after the other PRs were merged. |
coverage CI looks stuck. I'm messing around with it on poorly named pr #279 |
Now, I will merge the correct thing. Whoops. |
After #270, making
rand
optional means that it's possible to use a very stripped-down version of the crate:Like the
nalgebra
feature,rand
is enabled by default. This added modularity might make #165 easier, too.This requires a breaking change: Removing the
rand::distribution::Distribution<T>
supertrait fromstatrs::distribution::Distribution<T>
and::DiscreteDistribution<T>
. Semantically, it means that thestatrs
distributions are not required to berand
distributions and are not logical extensions of them. Practically, it just means that new distributions don't necessarily have to implement therand
Distribution trait (all current distributions still do implement it with the feature enabled).I would argue that the distribution traits still make sense without rand/RNG. This also allows using most of the
statistics
module without needing to compilerand
and all that entails.