Skip to content

update link of Range to Uniform in rand example #420

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

Merged
merged 4 commits into from
Jul 2, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,18 @@ fn main() {
}
```

Alternatively, one can use [`Range`] to obtain values with [uniform distribution].
Alternatively, one can use [`Uniform`] to obtain values with [uniform distribution].
This has the same effect, but may be faster when repeatedly generating numbers
in the same range.

```rust
extern crate rand;

use rand::distributions::{Range, Distribution};
use rand::distributions::{Uniform, Distribution};

fn main() {
let mut rng = rand::thread_rng();
let die = Range::new(1, 7);
let die = Uniform::new(1, 7);

loop {
let throw = die.sample(&mut rng);
Expand Down Expand Up @@ -1839,7 +1839,7 @@ fn run() -> Result<()> {
[`process::Stdio`]: https://doc.rust-lang.org/std/process/struct.Stdio.html
[`rand::Rng`]: https://docs.rs/rand/*/rand/trait.Rng.html
[`rand::thread_rng`]: https://docs.rs/rand/*/rand/fn.thread_rng.html
[`Range`]: https://docs.rs/rand/*/rand/distributions/#reexports
[`Uniform`]: https://docs.rs/rand/0.5.0/rand/distributions/uniform/struct.Uniform.html
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use wildcard URLs
https://docs.rs/rand*/rand/distributions/uniform/struct.Uniform.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected.

[`Standard`]: https://docs.rs/rand/*/rand/distributions/struct.Standard.html
[`Distribution`]: https://docs.rs/rand/*/rand/distributions/trait.Distribution.html
[`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
Expand Down