One possible way to encode this equation reads $$ \begin{equation*} A(j\rightarrow i)=\left\{\begin{array}{cc} \exp{(-\beta(E_i-E_j))} & E_i-E_j > 0 \\ 1 & else \end{array} \right., \end{equation*} $$ implying that if we move to a state with a lower energy, we always accept this move with acceptance probability \( A(j\rightarrow i)=1 \). If the energy is higher, we need to check this acceptance probability with the ratio between the probabilities from our PDF. From a practical point of view, the above ratio is compared with a random number. If the ratio is smaller than a given random number we accept the move to a higher energy, else we stay in the same state.