Sampling from a Distribution
Name
UxHwDoubleSample
, UxHwFloatSample
— Return a sample from the distribution.
Synopsis
#include <uxhw.h>
double UxHwDoubleSample(double value);
float UxHwFloatSample(float value);
Description
The UxHwDoubleSample()
function, on architectures that associate distributional information with floating-point values, draws a sample from the distribution associated with value
and returns it.
Parameters
value
— The distributional value to draw a sample from.
Return Values
The UxHwDoubleSample()
function returns a sample from the distribution value
. If value
has no distribution associated with it, it returns value
.
✏️ Examples
#include <stdio.h>
#include <uxhw.h>
int
main(void)
{
double a = UxHwDoubleUniformDist(10.0, 20.0);
double sample = UxHwDoubleSample(a);
printf("Sample of %lf is %lf\n", a, sample);
return 0;
}