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

Adding examples to ChaChaRng #106

Merged
merged 2 commits into from Jun 27, 2016

Conversation

Projects
None yet
3 participants
@peschkaj
Contributor

peschkaj commented Jun 24, 2016

  • Adds an example for creating an unseeded ChaChaRng.
  • Adds an example for using set_counter.
Adding examples to ChaChaRng
* Adds an example for creating an unseeded `ChaChaRng`.
* Adds an example for using `set_counter`.
/// # Examples
///
/// ```rust
/// use rand::{Rng, ChaChaRng};

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jun 24, 2016

Why do you import Rng?

This comment has been minimized.

@peschkaj

peschkaj Jun 24, 2016

Contributor

Build fails without it - next_u32 is from rng.

Only commenting again since the comment got lost after I pushed new code.

///
/// # Examples
///
/// ```

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jun 24, 2016

You forgot to add "rust": "```rust".

/// # Examples
///
/// ```
/// use rand::{Rng, ChaChaRng};

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jun 24, 2016

Why do you import Rng?

This comment has been minimized.

@peschkaj

peschkaj Jun 24, 2016

Contributor

next_u32 isn't a method of ChaChaRng, it's part of the Rng trait. Compilation fails without it.

This comment has been minimized.

@GuillaumeGomez
/// Since this equivalent to a RNG with a fixed seed, repeated executions
/// of an unseeded RNG will produce the same result. This code sample will
/// consistently produce:
/// - 2917185654

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jun 24, 2016

Markdown has list you know. 😛

This comment has been minimized.

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jun 24, 2016

Thanks for teaching me senpai! 🙇

@peschkaj

This comment has been minimized.

Contributor

peschkaj commented Jun 24, 2016

Not sure why travis is failing on nightly - nightly (rustc 1.11.0-nightly (ad7fe6521 2016-06-23)) is definitely building for me.

@alexcrichton

This comment has been minimized.

Collaborator

alexcrichton commented Jun 27, 2016

Thanks! That may just be for the rand_macros crate

@alexcrichton alexcrichton merged commit 3929045 into rust-random:master Jun 27, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

pitdicker pushed a commit to pitdicker/rand that referenced this pull request Apr 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment