The lottery is a form of gambling whose prizes are derived by random selection. Normally, a percentage of prize money is deducted as organizing costs and profit, while the remainder goes to the winners. This proportion is usually fixed by law or agreement, and is determined either by the size of the prize pool or by dividing tickets into fractions for sale in retail shops. In addition to the drawing, a lottery must have some mechanism for storing and transporting tickets and stakes. Generally, computers are used for this purpose, since they can easily handle large amounts of information and have the speed and storage capacity needed.

Throughout history, lotteries have been used to raise money for many purposes. The Bible describes the drawing of lots to determine property rights, and records from the Low Countries in the fifteenth century mention raising funds for town fortifications and helping the poor through lotteries. The lottery has been used by governments and private organizations to fund wars, college scholarships, and public-works projects.

The modern lottery emerged in the nineteen-sixties, when growing awareness of all the money to be made in gambling collided with a crisis in state funding. In this era of inflation, population growth, and the cost of the Vietnam War, state budgets were straining under their weight. To balance their books, legislators feared that they would have to cut taxes or slash government services. To placate a public averse to tax increases, they began to propose legalizing the lottery.