Slots work using a random number generator (RNG) that generates random sequences of numbers to determine the outcomes of each spin. The RNG ensures fairness and unpredictability.