-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Seed RNGs with a uniform type #13663
Comments
We discussed this on IRC a little at the time:
|
I actually don't think it's as big of an issue today, because all of the RNGs implement let seed_rng = XorShiftRng::from_seed([1, 2, 3, 4]);
let your_real_rng: IsaacRng = seed_rng.gen(); By routing your seeding through |
@SiegeLord This is very nice, I did not know that! I think this example should be added to the docs. However, this is not exactly the desired interface, because it only works for seeds that are of type
The latter is maybe not that important (still, some user might want to have a larger seed space), but it would be covered by a |
You can turn a single integer into a larger seed, e.g. |
For some RNGs it is not necessary to use a seeding RNG, because the bytes can be fed directly into them. |
@huonw is planning on stabilizing rand soon, so this concern might be part of that. |
RFC rust-lang/rfcs#722, the current design there is to not provide |
@huonw @steveklabnik Should this be closed now that |
I think the issue should rather be moved there. |
filed as rust-random/rand#80 |
I think it would be convenient to have a uniform way to reseed all RNGs. Currently, each RNG could potentially use (and often does so in practice) a different seed type for the
SeedableRng
trait implementation. I propose that trait to have the following two methods (and an associated function) added:The current methods could either be removed, or renamed to
reseed_exact
etc. It currently appears that some RNGs already do something similar to what the proposed functions do, while others (e.g.XorShiftRng
) require the complete state.The text was updated successfully, but these errors were encountered: