How to adjust the distribution of values in a random data stream?

Posted by BCS on Stack Overflow See other posts from Stack Overflow or by BCS
Published on 2010-03-10T20:20:38Z Indexed on 2010/05/26 18:11 UTC
Read the original article Hit count: 172

Given a infinite stream of random 0's and 1's that is from a biased (e.g. 1's are more common than 0's by a know factor) but otherwise ideal random number generator, I want to convert it into a (shorter) infinite stream that is just as ideal but also unbiased.

Looking up the definition of entropy finds this graph showing how many bits of output I should, in theory, be able to get from each bit of input.

Entropy of a coin flip in bits versus the fairness of the coin

The question: Is there any practical way to actually implement a converter that is nearly ideally efficient?

© Stack Overflow or respective owner

Related posts about random-number-generator

Related posts about information-theory