dhardy / rand

http://doc.rust-lang.org/rand
Other
2 stars 2 forks source link

NewSeeded: use JitterRng fallback #54

Closed dhardy closed 6 years ago

dhardy commented 6 years ago

I changed my mind about renaming as mentioned in #17: having "new" in the name is important to clarify that this provides a "new" function.

To prevent confusion, this completely prevents any user implementation of the NewSeeded trait, by making it only applicable to types implementing SeedFromRng anyway (from_rng may migrate to SeedableRng but that's a separate issue).

As @pitdicker put it elsewhere, this is supposed to "make it easy to do the right thing". If users or PRNG authors want a different seeding function, they can use a different trait/function (there's no reason another trait can't also provide a new function).

Since @nagisa @newpavlov @burdges commented on #17 I'll give them a chance to disagree here, but I don't find any of the arguments against this I've seen so far convincing.

(Note: the TODO comments are intended to stay in the source for now; #43 can implement one of them.)

burdges commented 6 years ago

I think NewSeeded is a better name than AutoSeeded if the function will be called new. I'm not overly worried about the new name since you can always call this as rand::NewSeeded::new::<MyRng>() if you do not want to use NewSeeded;, due to it claiming the name new.