Closed CrockAgile closed 6 years ago
You can use the gen
method after calling new
to use another StdGen
implementation. But that still involves creating a ThreadRng
instance which, over a sufficiently large number of test runs, may not be desirable. I think having another initialization method (new_with_gen
?) that allowed passing in another StdGen
implementation seems like a good idea. In particular using seeded RNGs seems like it could have a wide array of uses.
@Ryan1729 is right, use the gen
method if you want to use a different generator.
I don't understand what a hypothetical new_with_gen
would buy you that the existing gen
mutator doesn't.
I just had a look at the ThreadRng
docs which say that the rng is lazily-initialized. In that case, then I agree a new_with_gen
method wouldn't buy anyone very much.
All righty, closing this. If anyone has any other thoughts please feel free to comment and we can revisit.
StdGen
can use any implementer ofRng
, such asStdGen<IsaacRng>
,StdGen<OsRng>
,StdGen<XorShiftRng>
, etc. However the mainQuickCheck
type for configuring and running tests only implementsnew()
forStdGen<ThreadRng>
. Is this an oversight in its generics? Or is there a way to configure and run tests using these other randomness sources?