-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove dependency on system randomness #91
Conversation
Right, we should make sure everything builds in all the combinations. What about an alternative? With the default Cargo features, Would that not be simpler overall? The API would stay unchanged and the small utility functions like Basically, all you need to do is to create a common function which is used to get the default RNG if
Yeah, I agree, that seems overkill for us. |
A final thing, please add the magic |
I just had an even better idea (perhaps): we could use |
Thank you for your review! I have also retooled the Those methods take |
Hey Martin, thanks for the update! It looks good, I'll try to get to a proper view in a few days. |
I think |
getrandom
featureThis gives us a simple way to have `lipsum` return random output without depending on `thread_rng`. This is a followup to #91.
As discussed in #74, here is a PR that makes system randomness an optional (but enabled by default) feature.
The catch of this PR is that it interacts badly with the test for the example.
cargo build --no-default-features
works as intended, butcargo test --no-default-features
will fail unless the code in the main function ofexamples/lipsum.rs
is removed. Furthermore, I had to adapt one documentation example such that it would work withoutthread_rng
. There are methods to exclude examples from doctesting depending on the features the crate is built with, but they are ugly.I'd be happy to incorporate any feedback on naming / test architecture. Have a nice day!