A Monte Carlo implementation of the Ising Hamiltonian on a hypercube of arbitrary dimension