Skip to content
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

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

Open
agarie opened this issue May 28, 2015 · 0 comments
Open

Comments

@agarie
Copy link
Member

agarie commented May 28, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant