Skip to content

{Independent,}Sample trait for StandardNormal or rename to Ziggurat #97

@SuperFluffy

Description

@SuperFluffy

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-new-intFunctionality: new, within Rand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions