lkml.org 
[lkml]   [2006]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 11/13] Core Resource Allocation
From
Date
 > +static u32 next_random(u32 rand)
> +{
> + u32 y, ylast;
> +
> + y = rand;
> + ylast = y;
> + y = (y * 69069) & 0xffffffff;
> + y = (y & 0x80000000) + (ylast & 0x7fffffff);
> + if ((y & 1))
> + y = ylast ^ (y > 1) ^ (2567483615UL);
> + else
> + y = ylast ^ (y > 1);
> + y = y ^ (y >> 11);
> + y = y ^ ((y >> 7) & 2636928640UL);
> + y = y ^ ((y >> 15) & 4022730752UL);
> + y = y ^ (y << 18);
> + return y;
> +}

How about just using the kernel's random32()?

I haven't read the code really so I don't understand what's being
randomized here, but random32() should be more than good enough for a
typical randomized algorithm().

- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-17 17:57    [W:0.126 / U:23.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site