Much better genPercept() implementation.

Now only numBits probabilities need to be computed,
as compared to the 2 ^ numBits probabilities that were being computed
before.