Fix fencepost error.
Improve overflow handling.
Add thread safe initialization.
Kill some warnings, add iterator based results.
Change max_bernoulli to max_bernoulli_b2n