-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
from_rng
and value-stability
#572
Comments
I consider stability the normal case myself because everybody must write test vectors eventually. There is never anything to prevent traits from being implemented wrong, at least not until we get trait tests, so I'd suggest you write roughly: """ We therefore ask that stable We could look into requiring PRNGs that exploit instability to warn users with a wrapper type, but imho that's overkill, and might discourage them from exposing both stable and unstable variants
|
I think we should keep things as simple as possible. Documentation alone may be enough, but it would be clearer to add another marker trait: pub trait StableRng: SeedableRng {} |
Could you please give a more concrete example? It is not clear to me why you would want to implement |
I struck out the confusing sentence fragment because I agree such intentionally non-deterministic I'm weakly against a marker trait because stability should be so common that a marker trait wastes everyone's time. |
I think that category would mainly be populated by generators which are deterministic but where the code behind them may change. I agree with @burdges; there is little reason to add a marker trait. We could recommend that By the way, what do you think of the original idea suggested in this thread, of dropping the note about instability of |
I agree with dropping the existing note of course. I wrote the text above as a "replacement" that encourages good behavior. I'll make it more compact:
Another idea would saying that |
Sounds about right except for this bit. If someone specifically wants an unstable No to the last point, stability is not specifically a cryptographic feature. |
From the doc for
SeedableRng::from_rng
:The rationale of not making this method value-stable is to allow more room for optimisation and potentially entropy:
Hc128Rng
, ISAAC) can fill the entire state directly instead of using key expansion — except we never implemented this forHc128Rng
, and ISAAC still uses the same routines to scramble the key in case it is poor qualityThe rationale against this:
let mut my_new_rng = MyRng::from_rng(master_rng);
, but we have to tell people not to do this if they want value-stabilitySo it seems sensible to change this. I'd like @pitdicker's input since he was part of the current design.
Making this value-stable in a future version of
rand_core
is not a breaking change in any way, though users should not be able to count on value-stability until their dependencies depend on the newrand_core
version.The text was updated successfully, but these errors were encountered: