Lottery is a game of chance that gives players a prize based on how many of their numbers match those chosen in a random drawing. It’s a popular form of gambling that is run by governments and private companies. Lottery games have roots as far back as the Old Testament and ancient Roman times, and they became popular in colonial America to help build roads, churches, schools and other public works projects without raising taxes.

Today’s lotteries are regulated by state and federal laws. The money collected from ticket sales goes toward the prizes and costs associated with organizing and promoting the lottery. Some states also use the funds to support public education, though it’s a different formula for every state. For example, Maryland and New Jersey use lottery revenue to provide education grants for all students enrolled in a particular county, while Pennsylvania distributes its funds based on the average daily attendance of K-12 and community college school districts and full-time enrollment at higher education institutions.

Often, lottery players choose their own numbers, and that can make them a target for hackers who can use computer programs to create patterns in the winning numbers. To protect their information and privacy, Clotfelter recommends that lottery players use numbers that aren’t related to their personal data, like birthdays, home addresses or social security numbers.

Lottery prizes don’t have a cash value until they are claimed by a winner. Then the prize is paid out either in one lump sum or in an annuity that gives the winner a first payment when they win, followed by 29 annual payments that increase each year by 5%. If the winner dies before all of the annual payments are made, the remainder will become part of their estate.