You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove derivations of `Copy` trait from `ChaChaRng`, `IsaacRng`, `Isaac64Rng`
and `StdRng` and implement the `Clone` trait instead.
Copying is an implicit operation and the copy shares its internal state with
the original generator. This means the the two generators will yield exactly
the same sequence of values. This behaviour is considerably easy to trigger
by, for example, passing the generator by value to a function.
`Clone` trait, on the other hand, does no implicit copying. The user will only
be able to either move the generator or ask for a copy explicitly, via the
`clone` method.
The only downside to this patch is the fact that the implementations of
`Clone::clone` methods do not optimise down to a single memcpy, like the
derived `Copy` implementations did.
Although the `Copy` implementations of these random number generators are
suspected to not be used much, this is a [breaking-change].
Fixesrust-lang#20170.
0 commit comments