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 The lower bound of the Uniform distribution.
  • b The upper bound of the Uniform distribution.

Return Values

The UxHwDoubleUniformDist() function returns the mean of samples of a Uniform distribution with parameters a and b. If b < a, the function returns 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;
}