[email protected] wrote: > Another way to solve this problem would be to trim the numbers with > something like this: if (denom > UINT32_MAX) denom = UINT32_MAX.
And then document that the program returns incorrect results? > >However, using drand48() will mean using a floating point modulus. > >We lose the uniform aspect. I'm not the non-uniform aspects are as > >visible in the floating point range. Succeeding for the full floating > >point range is more important than what arc4random_uniform() is trying > >to do. But maybe a uniform version of the double code can grow out of > >using the drand48.c code? > > Theo, I'm not sure I understand your reasoning. Are you trying to say > that we should see if it's possible to create a drand48_uniform? Yes, inside the program.
