Underneath the flashing lights and free cocktails, casinos are mathematically engineered to slowly bleed patrons of their cash. But a few mathematically inclined minds have attempted to turn the tables, armed with probability theory and game theory.

Casinos earn money by raking in bets on games of chance, such as slot machines and table games. They also make money from commissions on games with skill, such as blackjack and poker. Casinos typically employ mathematicians specializing in gaming analysis to determine the expected return on their investment for each machine and table, including the house edge and variance.

Table games with a skill element, such as blackjack, have a house edge determined by the rules of the game and the specific strategy. However, the casino can lower the house edge by offering better odds or higher stakes, or both.

Some games, such as craps and baccarat, have high house edges. Others, such as keno and roulette, have low house edges. A casino’s goal is to make enough money to cover its operating expenses and pay its employees, so it may choose to offer a higher house edge or smaller payouts in order to attract more patrons.

Casinos draw huge numbers of gamblers from around the world, and the Strip in Las Vegas is especially famous. The business has become a major source of revenue for the state of Nevada and other states that legalize gambling. Casinos are sometimes funded by organized crime, whose members have a lot of money from drug dealing and other illegal rackets. They often use this money to fund the expansion and renovation of their establishments, or even take sole or partial ownership.