Class: Normcore::Normal
Overview
The normal a.k.a. Gaussian distribution
en.wikipedia.org/wiki/Box–μller_transform
Usage:
normal = Normal.new(0, 1)
normal.rng # return one sample
normal.sample(10) # return 10 samples
Direct Known Subclasses
Instance Attribute Summary collapse
-
#μ ⇒ Object
readonly
Returns the value of attribute μ.
-
#σ ⇒ Object
readonly
Returns the value of attribute σ.
Instance Method Summary collapse
-
#initialize(μ, σ) ⇒ Normal
constructor
A new instance of Normal.
-
#rng ⇒ Object
yield samples from gaussian distribution using the Box-μller transform.
Methods inherited from Base
Constructor Details
#initialize(μ, σ) ⇒ Normal
Returns a new instance of Normal.
18 19 20 21 |
# File 'lib/normal.rb', line 18 def initialize |
Instance Attribute Details
#μ ⇒ Object (readonly)
Returns the value of attribute μ.
16 17 18 |
# File 'lib/normal.rb', line 16 def |
#σ ⇒ Object (readonly)
Returns the value of attribute σ.
16 17 18 |
# File 'lib/normal.rb', line 16 def |
Instance Method Details
#rng ⇒ Object
yield samples from gaussian distribution using the Box-μller transform
26 27 28 |
# File 'lib/normal.rb', line 26 def rng box_muller end |