See D1891 comments and change history to see what this fix looks like. A helper for us to avoid direct usage of randbits() would be helpful. See D1700 for the first instance and more explanation for why it is necessary.