-
Notifications
You must be signed in to change notification settings - Fork 430
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
Implement From<RangeInclusive>
for Uniform
#566
Conversation
If we decide against merging this, I think f3c8f85 should be cherry-picked onto master. |
src/distributions/uniform.rs
Outdated
let r = Uniform::from(2.0f64..=7.0); | ||
assert_eq!(r.inner.low, 2.0); | ||
assert!(r.inner.scale > 5.0); | ||
assert!(r.inner.scale < 5.0 + 1e15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be 1e-15?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that was indeed a typo.
Cargo.toml
Outdated
@@ -25,6 +25,7 @@ alloc = ["rand_core/alloc"] # enables Vec and Box support (without std) | |||
i128_support = [] # enables i128 and u128 support | |||
simd_support = [] # enables SIMD support | |||
serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs | |||
rust_1_27 = [] # enables RangeInclusive support for Rust >= 1.27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, why not.
I think this can imply i128_support
, but probably not simd_support
since not all of that is stable yet(?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. simd_support
is currently broken and being addressed in #565.
Looks good. @pitdicker did you want to review? And any further comments about adding |
Personally, I don't need it, but I think that some authors of Rand's most popular dependent crates (@cuviper, @BurntSushi) like to avoid bumping the minimal Rust version. My plan was to ship Rand 0.6 without bumping the minimal Rust version (given there is not a very strong motivation) to maximize adoption of 0.6. We could then bump it for 0.7. On the other hand, |
I don't have any opinions on optional features, but I think bumping the minimum Rust version for a core library like |
Which is why I suggested making the Rand version requirement more flexible in BurntSushi/byteorder#127 and rust-lang/regex#500. Although I suppose that may still cause problems since there is no Rust version dependency requirement in Rust is still a rapidly moving target and many core libraries are still unstable, so compatibility with old language versions is a burden and in my view not very useful, although compatibility over the last six months of Rust releases may be prudent (which is approximately where we are now with 1.22). |
Regarding a |
@cuviper That seems like the best option, I'll look into it. |
I rebased on master, replaced the |
Only thing I can see against this is the potential for build failures when using older compilers due to implicit feature activation, but this is the same as for inclusion of Only build failure is the SIMD one — so lets go! |
How could that happen? The build script checks for the Rust version, so it should never fail on old compilers. (As long as we don't use |
Fixes #556.