Hi Vincent,

Thanks for the patch. I was able to verify that the patch made the
distribution uniform over a large (300+) output from rand.

Regards,
Vivek

On Mon, Dec 8, 2014 at 4:45 PM, Vincent Bernat <[email protected]> wrote:
>  ❦  8 décembre 2014 23:20 +0100, Vincent Bernat <[email protected]> :
>
>> Assuming that RAND_MAX is always a power of two - 1, 32 could be
>> replaced by a precomputed value of ffs(RAND_MAX+1)-1.
>
> ebtree defines a fls64() function which seems best suited (RAND_MAX+1
> could overflow). Here is a proposed patch for this:
>
>
>
>
> --
> Let the machine do the dirty work.
>             - The Elements of Programming Style (Kernighan & Plauger)
>

Reply via email to