Skip to content

Incremental std::rand improvements #9362

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 3 commits into from
Sep 22, 2013
Merged

Incremental std::rand improvements #9362

merged 3 commits into from
Sep 22, 2013

Conversation

huonw
Copy link
Member

@huonw huonw commented Sep 20, 2013

First steps on toward a shiny new std::rand, this does a variety of relatively clean-up tasks, like:

  • moving std/rand.rs to std/rand/mod.rs in preparation for (e.g.) splitting the large chunk that is the Isaac implementation into a separate file later.
  • removing the now unused RNG code in the old rt (500 lines gone just like that!)
  • merging Rng and RngUtil via default methods
  • examples in the documentation for almost all methods.

And other things mentioned in the commit messages.

} else {
self.gen_uint_range(1u, n + 1u) == 1u
/// Return a random vector of the specified length. This defers to
/// the `rand_vec` implementation of the requested type, and, as
Copy link
Member

Choose a reason for hiding this comment

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

rand_vec doesn't seem to exist

@huonw
Copy link
Member Author

huonw commented Sep 20, 2013

Review addressed.

Also, documentation & general clean-up:
- remove `gen_char_from`: better served by `sample` or `choose`.
- `gen_bytes` generalised to `gen_vec`.
- `gen_int_range`/`gen_uint_range` merged into `gen_integer_range` and
  made to be properly uniformly distributed. Fixes rust-lang#8644.

Minor adjustments to other functions.
This has to leave rust_gen_seed and rng_gen_seed around since they're
used to initialise the std::rand RNGs.
bors added a commit that referenced this pull request Sep 22, 2013
First steps on toward a shiny new `std::rand`, this does a variety of relatively clean-up tasks, like:
- moving `std/rand.rs` to `std/rand/mod.rs` in preparation for (e.g.) splitting the large chunk that is the `Isaac` implementation into a separate file later.
- removing the now unused RNG code in the old rt (500 lines gone just like that!)
- merging Rng and RngUtil via default methods
- examples in the documentation for almost all methods.

And other things mentioned in the commit messages.
@bors bors closed this Sep 22, 2013
@bors bors merged commit 0951313 into rust-lang:master Sep 22, 2013
@huonw huonw deleted the rand branch September 22, 2013 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants