ising simple sampling C++ code