Skip to content

auto: rand::Rand: a trait implemented by types that can be randomly generated #4801

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

Closed
wants to merge 1 commit into from

Conversation

z0w0
Copy link
Contributor

@z0w0 z0w0 commented Feb 5, 2013

Also adds Rng::gen() for generically generating any type that implements the Rand trait. There's no way to generate things with a length (for e.g. strings or vectors), because I can't think of an elegant way to do that. Maybe have a RandLen trait that inherits Rand?

This can be used for a quickcheck mechanism I'm working on.

randomly generated
Also adds Rng::gen() for generating any type that implements the Rand
trait
@graydon
Copy link
Contributor

graydon commented Feb 5, 2013

Awesome. I was literally writing this trait up yesterday! Glad you beat me to it.

@graydon
Copy link
Contributor

graydon commented Feb 5, 2013

(Future reference: non-uniform sampling is important and gets very ... subtle, and very interesting, when dealing with more complex structures. See: http://algo.inria.fr/flajolet/Publications/DuFlLoSc04.pdf for examples)

bors added a commit that referenced this pull request Feb 5, 2013
Also adds Rng::gen() for generically generating any type that implements the Rand trait. There's no way to generate things with a length (for e.g. strings or vectors), because I can't think of an elegant way to do that. Maybe have a RandLen trait that inherits Rand?

This can be used for a quickcheck mechanism I'm working on.
bors added a commit that referenced this pull request Feb 7, 2013
Also adds Rng::gen() for generically generating any type that implements the Rand trait. There's no way to generate things with a length (for e.g. strings or vectors), because I can't think of an elegant way to do that. Maybe have a RandLen trait that inherits Rand?

This can be used for a quickcheck mechanism I'm working on.
@bors bors closed this Feb 7, 2013
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