[Click] random bit errors element
Eddie Kohler
kohler at cs.ucla.edu
Mon Feb 27 17:30:17 EST 2006
OK, cool; do look at the code in CVS and see whether it agrees. It is wise to
right-shift the result of random() because in many implementations its
low-order bits are less random than its higher-order bits.
E
Alastair McKinley wrote:
> On Feb 27 2006, Eddie Kohler wrote:
>
>> Hi Alastair,
>>
>> Thanks for the patch! You missed one important fix, around line 168,
>> which would need changes to produce a random number with 28 bits of
>> randomness. There are a few other places too. I've checked in a fixed
>> (I hope) version that seems to work. Thanks again!
>>
>> Eddie
>>
>>
> Hi Eddie,
>
> Thanks for the email. I think I just sorted it out myself, at least it
> was working pretty much as I expected (I was working on a proper test
> this afternoon!). I was also wondering about something, why do you bit
> shift the values from random() eg.
>
> int v = (random() >> 3) & 0xFFFFFFF;
>
> and
>
> unsigned char errors = bit_flip_array[ ((random() >> 5) % n) + idx ];
>
> I didnt quite figure that out, but anyway!
>
> Thanks again,
>
> Alastair
More information about the click
mailing list