Parallel
aa0402.txt
Associated article: Algorithm Alley: Unbiasing Random Bits
Tags: Parallel
Published source code in the article by Michael Mitzenmacher in which he presents a means of efficiently extracting random bits from a possibly biased source of bits.
Algorithm Alley
by Michael Mitzenmacher
Listing One
Function ExtractBits ( Flips[0,NumFlips-1] )
for (j = 0; j < (NumFlips-1)/2; j++) {
if ( Flips[2*j] == Heads ) and ( Flips[2*j+1] == Tails ) print 0;
if ( Flips[2*j] == Tails ) and ( Flips[2*j+1] == Heads ) print 1;
}
}
Listing Two
Function ExtractBits ( Flips[0,...


