Skip to content

All normal distribution functions should accept mean and stddev parameters #23

Description

@agarie

The functions in Distribution::Normal doesn't accept mean and standard deviation parameters. Alright, we can scale the results ourselves, but this is awful practice. For example:

require 'distribution'

Distribution::Normal.rng(4.3, 0.3)
Distribution::Normal.cdf(3, 5)

What about having named parameters? The interesting part of not having named parameters is that I can provide an Array as in

params = [4.3, 0.3]
Distribution::Normal.rng(*params)

However, with named params:

named_params = { mean: 4.3, stddev: 0.3 }
Distribution::Normal.rng(**named_params)

named2 = { mean: 4.3, stddev: 0.3, stuff: nil }
Distribution::Normal.rng(**named2) # => ArgumentError: unknown keyword: stuff

Probably better.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions