Skip to content

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

Closed
z0w0 wants to merge 1 commit intorust-lang:incomingfrom
z0w0:randomtrait
Closed

auto: rand::Rand: a trait implemented by types that can be randomly generated#4801
z0w0 wants to merge 1 commit intorust-lang:incomingfrom
z0w0:randomtrait

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
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Jan 4, 2026
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

Comments