Skip to content
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

Seedable RNG and separation/extension of .gen_* functions #2379

Closed
Dretch opened this issue May 13, 2012 · 4 comments
Closed

Seedable RNG and separation/extension of .gen_* functions #2379

Dretch opened this issue May 13, 2012 · 4 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@Dretch
Copy link
Contributor

Dretch commented May 13, 2012

There should be some sort of seedable implementation of rand::rng so that sequences of random operations can be easily reproduced.

The gen_* methods in the rand::rng iface should be separated out into an iface-less implementation for the rand::rng iface-type, i.e.:

impl gen for rng {
    fn gen_str (len: uint) -> str { ... }
    ....
}

This will allow multiple implementations of the rand::rng iface to use the gen_* methods.

There should be more gen_* methods available, for example:

  • there should be one for each primitive integer/float type
  • there should be shuffle-vector, choose-from-vector, choose-from-weighted-vector methods
  • the functions from /src/fuzzer/rand_util.rs should become gen_methods

Motivation

I have been writing a fuzzer and I would have found these things useful to have in the core/std library.

@brson
Copy link
Contributor

brson commented May 13, 2012

Yes, please.

@pcwalton
Copy link
Contributor

Also useful for quickcheck (which is basically a fuzzer).

@Dretch
Copy link
Contributor Author

Dretch commented May 16, 2012

Ok then, I would like to work on this. I will submit a pull request when i'm ready.

@eholk
Copy link
Contributor

eholk commented Jun 1, 2012

I'm closing this, since it looks like the code to do it is already in the tree.

@eholk eholk closed this as completed Jun 1, 2012
mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Mar 21, 2014
…hat the gen_* methods can be reused with different rng implementations (for rust-lang#2379)
mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Mar 21, 2014
mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Mar 21, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
ui_test: more robust syntax for target filtering

Implicit fallbacks are always fragile and prone to typos, so let's be explicit.
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Co-authored-by: Qinheping Hu <qinhh@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

4 participants