The OpenD Programming Language

uniformDiscreteInvCDF

Computes the discrete uniform inverse cumulative distribution function (InvCDF)

@safe pure nothrow @nogc
size_t
uniformDiscreteInvCDF
(
T
)
(
const T p
,
const size_t lower = 0
,
const size_t upper = 1
)
if (
isFloatingPoint!T
)

Parameters

p T

value to evaluate InvCDF

lower size_t

lower bound

upper size_t

upper bound

Examples

.

import mir.test: should;

0.0.uniformDiscreteInvCDF.should == 0;
0.5.uniformDiscreteInvCDF.should == 0;
1.0.uniformDiscreteInvCDF.should == 1;

0.0.uniformDiscreteInvCDF(1, 3).should == 1;
0.2.uniformDiscreteInvCDF(1, 3).should == 1;
(1.0 / 3).uniformDiscreteInvCDF(1, 3).should == 1;
0.5.uniformDiscreteInvCDF(1, 3).should == 1;
(2.0 / 3).uniformDiscreteInvCDF(1, 3).should == 2;
1.0.uniformDiscreteInvCDF(1, 3).should == 3;

See Also

Meta