Understand and fix boost::random issues