All structs in rand::distributions implement the Sample and IndependentSample trait, which gives us the ability to call fn ind_sample<R: Rng>(&self, &mut R) -> Support, with Support the value of our random number.
However, StandardNormal, also in rand::distributions, does not implement the aforementioned traits, but Rand instead, which allows to call fn rand<R: Rng>(rng: &mut R) -> Self, where self will be StandardNormal(x), with x the value of our random number.
I believe this to be an inconsistency. Either StandardNormal should be moved out of rand::distributions to make it explicit that it behaves in a completely different way, or the Sample and IndependentSample traits should be implemented for it.
Alternatively, I propose StandardNormal to be renamed to ZIGNOR (or Ziggurat, I guess).
All structs in
rand::distributionsimplement theSampleandIndependentSampletrait, which gives us the ability to callfn ind_sample<R: Rng>(&self, &mut R) -> Support, withSupportthe value of our random number.However,
StandardNormal, also inrand::distributions, does not implement the aforementioned traits, butRandinstead, which allows to callfn rand<R: Rng>(rng: &mut R) -> Self, where self will beStandardNormal(x), withxthe value of our random number.I believe this to be an inconsistency. Either
StandardNormalshould be moved out ofrand::distributionsto make it explicit that it behaves in a completely different way, or theSampleandIndependentSampletraits should be implemented for it.Alternatively, I propose
StandardNormalto be renamed toZIGNOR(orZiggurat, I guess).