ae.utils.math.distribution

Very basic (and probably buggy) numeric distribution / probability operations. WIP, do not use.

Members

Functions

and
Probability and(Probability a, Probability b)

Return the probability of both unrelated events a and b occurring.

cond
void cond(Probability p)

Apply doIf if p is possible. doIf receives the probability of the event (non-zero).

cond
void cond(Probability p)

Apply doIf if p is possible, and/or doElse if !p is possible, doIf and doElse receive the probability of their respective event (non-zero).

not
Probability not(Probability a)

Return the probability of event a not occurring.

or
Probability or(Probability a, Probability b)

Return the probability of at least one of the unrelated events a and b occurring.

range
Range!T range(T lo, T hi, T avg)
Undocumented in source. Be warned that the author may not have intended to support it.
range
Range!T range(T lo, T hi)
Undocumented in source. Be warned that the author may not have intended to support it.
range
Range!T range(T val)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

Probability
struct Probability

Indicates the probability of a certain event.

QuantizedDistribution
struct QuantizedDistribution(size_t numSegments, P = float, V = double)

A quantized representation of a the probability distribution of some continuous function returning a value between 0 and 1.

Range
struct Range(T)

A simplified representation of some probability distribution. Supports uniform distributions and basic operations on them (sum / product).

Templates

cmp
template cmp(string op)

Return the probability that a op b, where op is < / <= / > / >=, and a and b are numbers or ranges representing a uniform distribution.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>