The OpenD Programming Language

uniformDiscreteCDF

Computes the discrete uniform cumulative distribution function (CDF).

@safe pure nothrow @nogc
double
uniformDiscreteCDF
(
const size_t x
,
const size_t lower = 0
,
const size_t upper = 1
)

Parameters

x size_t

value to evaluate CDF

lower size_t

lower bound

upper size_t

upper bound

Examples

import mir.test: shouldApprox;

0.uniformDiscreteCDF.shouldApprox == 0.5;
1.uniformDiscreteCDF.shouldApprox == 1.0;

1.uniformDiscreteCDF(1, 3).shouldApprox == 1.0 / 3;
2.uniformDiscreteCDF(1, 3).shouldApprox == 2.0 / 3;
3.uniformDiscreteCDF(1, 3).shouldApprox == 1.0;

See Also

Meta