Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cashflow ¶
type Cashflow struct { Name string IsOutflow bool Periods string Dist Randomizer Growth Growth }
Cashflow models the setup information needed for a cashflow for the Monte Carlo simulation.
type Config ¶ added in v0.5.0
type Config struct { Name string `json:"name"` StartPeriod int `json:"startPeriod"` EndPeriod int `json:"endPeriod"` Sims int `json:"sims"` Cashflows []Cashflow `json:"cashflows"` }
Config models the net cashflows configuration information.
func (*Config) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON byte slice into a Config struct.
type Fixed ¶
type Fixed float64
Fixed is a fixed number.
func (*Fixed) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON data into a Fixed MCS distribution.
type Growth ¶ added in v0.3.0
type Growth struct { Periods string Dist Randomizer Name string }
Growth models the setup information for a Growth rate.
type PERT ¶
type PERT struct {
// contains filtered or unexported fields
}
PERT models a PERT distribution with the values min, max, mode but without a random source.
func NewPERT ¶ added in v0.7.0
NewPERT constructs a new PERT distribution without a random source using the given min, max, and mode. Constraints are min < max and min ≤ mode ≤ max.
func (PERT) Randomize ¶ added in v0.4.0
Randomize sets up a new PERT distribution using the given random source.
func (*PERT) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON data into a PERT MCS distribution.
type PERTOne ¶ added in v0.7.0
type PERTOne struct {
// contains filtered or unexported fields
}
PERTOne models a PERT distribution once with the values min, max, mode, and then returns the same number each time. PERTOne does not have a random source.
func NewPERTOne ¶ added in v0.7.0
NewPERTOne constructs a new PERT distribution without a random source using the given min, max, and mode. Constraints are min < max and min ≤ mode ≤ max. Once the random number has been generated using the PERT distribution, the same number will be returned each time.
func (*PERTOne) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON data into a PERT MCS distribution.
type Rander ¶
type Rander interface {
Rand() float64
}
Rander is the interface that wraps the Rand method.
The Rand method returns a random sample drawn from the distribution.
type Randomizer ¶ added in v0.4.0
Randomizer is the interface that wraps the Randomize method.
Randomizer allows different random sources to be injected into the returned Rander interface. The ability to inject random sources is why the cashflows don't simply take a Rander but instead use a Randomizer for their distributions.
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
Triangle is a triangle distribution with the values min, max, mode.
func NewTriangle ¶ added in v0.7.0
NewTriangle returns a new triangle distribution with the values min, max, and mode.
func (*Triangle) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON data into a PERT MCS distribution.
type TriangleOne ¶
type TriangleOne struct {
// contains filtered or unexported fields
}
TriangleOne use a triangle distribution once and then returns the same number each time.
func NewTriangleOne ¶ added in v0.7.0
func NewTriangleOne(min, max, mode float64) TriangleOne
func (TriangleOne) Randomize ¶ added in v0.4.0
func (to TriangleOne) Randomize(src rand.Source) Rander
Randomize sets up a new one-time only triangle distribution.
func (TriangleOne) String ¶ added in v0.9.0
func (to TriangleOne) String() string
String implements the io.Stringer interface.
func (*TriangleOne) UnmarshalJSON ¶ added in v0.7.0
func (to *TriangleOne) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the given JSON data into a PERT MCS distribution.
type Uniform ¶
type Uniform struct {
// contains filtered or unexported fields
}
Uniform is a uniform distribution with the values min and max.
func NewUniform ¶ added in v0.7.0
NewUniform constructs a new Uniform distribution without a random source using the given min and max values.
func (*Uniform) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON unmarshals the given JSON data into a PERT MCS distribution.