The algorithm uses a couple of tricks. First, in a Metropolis algorithm, a key step is to propose an update and calculate how it would change the system energy. Thermal fluctuations are incorporated ...