Update to using c++11 uniform_int_distribution random number generator. Clean up and add comments.