Skip to main content

Uniform Distribution

Name​

UxHwDoubleUniformDist, UxHwFloatUniformDist — Create a Uniform distribution.

Synopsis​

#include <uxhw.h>

double UxHwDoubleUniformDist(double a, double b);
float UxHwFloatUniformDist(float a, float b);

Description​

The UxHwDoubleUniformDist() function, on architectures that associate distributional information with floating-point values, creates a Uniform distribution with parameters a and b and associates it with its return value. The particle return value is the mean value of a Uniform distribution with parameters a and b.

Parameters​

  • a ∈(−∞,b]\in (-\infty, b] — The lower bound of the Uniform distribution.
  • b ∈[a,∞)\in [a, \infty) — The upper bound of the Uniform distribution.

Return values​

The UxHwDoubleUniformDist() function returns the mean value of a Uniform distribution with parameters a and b and associates it with a Uniform distribution with parameters a and b. If a = b, the function returns a.

Illegal parameter values​

If b < a, the function returns NaN. If a or b is NaN, or b is INFINITY, the function returns -NaN. See Handling of NaN.

Examples​

#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double value = UxHwDoubleUniformDist(0.1, 1.0);
printf("value = %lf\n", value);

return 0;
}