Uniform

Interface

uniform(a:real, b:real) : real

where a<=b. Returns a drawing from a continuous uniform distribution between a and b.

Raises Uniform exception, if a>b.

Characteristics

Mean: (a+b)/2
Variance: ((b-a)^2)/12

Density functions for continuous uniform distributions:

Density functions for continuous uniform distributions

Example

uniform(1.0,10.0)

A person is asked to choose a real number between 1 and 10. This random variable is uniformly distributed with parameters a=1.0 and b=10.0.

Related pages