code: def _ising_update(field, n, m, beta):
      total = 0
      N, M = field.shape
      for i in range(n - 1, n + 2):
          for j in range(m - 1, m + 2):
              if i == n and j == m:
                  continue
              total += field[clamp(i, N), clamp(j, M)]
      dE = 2 * field[n, m] * total
      if dE <= 0:
          field[n, m] *= -1
      elif np.exp(-dE * beta) > 0.5:  # np.random.rand():
          field[n, m] *= -1
  
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _ising_update(field, n, m, beta) without return types