Slot machines are programmed using a combination of hardware and software elements. At their core, they operate on random number generators (RNGs), which ensure unpredictable outcomes for each spin. The software is designed to define the game's rules, including payout percentages, paylines, and bonus features. This programming is often developed in compliance with gaming regulations to ensure fairness and integrity.