On Tue, Mar 15, 2016 at 12:47:00AM -0400, Ganesh Ajjanagadde wrote:
[...]
> +static inline double ziggurat(AVRAND64 *rng)
> +{
> +    while (1) {
> +        int64_t rabs;
> +        double x;
> +        uint8_t idx;
> +        uint64_t r = av_rand64_get(rng) & 0x000fffffffffffff;
> +        rabs = (int64_t) (r >> 1);
> +        idx = rabs & 0xff;
> +        x = ((r & 1) ? -rabs : rabs) * wi[idx];

to get good quality numbers from most PRNGs the MSBs are better than
the LSBs
this is true for LCGs, LFGs, xorshift128+ and others

also the commonly used PRNG tests are biased toward testing the
MSBs when they test the numbers as scalars



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to