Class: Capricious::Exponential
- Inherits:
-
Object
- Object
- Capricious::Exponential
- Includes:
- PRNG
- Defined in:
- lib/capricious/exponential.rb
Overview
Exponential-distribution PRNG
Instance Attribute Summary collapse
-
#expected_mean ⇒ Object
readonly
Returns the value of attribute expected_mean.
-
#expected_variance ⇒ Object
readonly
Returns the value of attribute expected_variance.
Instance Method Summary collapse
-
#initialize(l, seed = nil, policy = MWC5, keep_stats = false) ⇒ Exponential
constructor
Initializes a new distribution.
Methods included from PRNG
included, #next, #prng_initialize, #reset
Constructor Details
#initialize(l, seed = nil, policy = MWC5, keep_stats = false) ⇒ Exponential
Initializes a new distribution. =l= is the lambda parameter; =seed=,
policy=, and =keep_stats= are as in =PRNG=.
30 31 32 33 34 |
# File 'lib/capricious/exponential.rb', line 30 def initialize(l, seed=nil, policy=MWC5, keep_stats=false) @expected_mean = 1 / l.to_f @expected_variance = 1 / (l * l).to_f prng_initialize(seed, policy, keep_stats) end |
Instance Attribute Details
#expected_mean ⇒ Object (readonly)
Returns the value of attribute expected_mean.
26 27 28 |
# File 'lib/capricious/exponential.rb', line 26 def expected_mean @expected_mean end |
#expected_variance ⇒ Object (readonly)
Returns the value of attribute expected_variance.
26 27 28 |
# File 'lib/capricious/exponential.rb', line 26 def expected_variance @expected_variance end |