[PATCH 06/34] drm: Add a simple linear congruent generator PRNG
David Herrmann
dh.herrmann at gmail.com
Tue Dec 13 16:21:57 UTC 2016
Hey Chris
On Tue, Dec 13, 2016 at 4:40 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Tue, Dec 13, 2016 at 04:18:35PM +0100, David Herrmann wrote:
>> On Tue, Dec 13, 2016 at 4:16 PM, David Herrmann <dh.herrmann at gmail.com> wrote:
>> > On Mon, Dec 12, 2016 at 12:53 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>> > for (i = 0; i < count; ++i)
>> > swap(order[i], order[drm_lcg_random(state) % count]);
>> >
>> > Much simpler and I cannot see why it wouldn't work.
>>
>> Hint: swap() does multiple evaluations. So this needs to be:
>
> Hmm, and on switching to size_t count may be larger than u32...
I didn't mean to suggest 'size_t'. All I cared about was 'unsigned'.
So feel free to use 'u32', 'unsigned int', 'size_t', etc.
Thanks
David
More information about the dri-devel
mailing list