The lottery is a popular game where players purchase tickets in order to win a…