From Wired:

As a trained statistician with degrees from MIT and Stanford University, Srivastava was intrigued by the technical problem posed by the lottery ticket. In fact, it reminded him a lot of his day job, which involves consulting for mining and oil companies. A typical assignment for Srivastava goes like this: A mining company has multiple samples from a potential gold mine. Each sample gives a different estimate of the amount of mineral underground. “My job is to make sense of those results,” he says. “The numbers might seem random, as if the gold has just been scattered, but they’re actually not random at all. There are fundamental geologic forces that created those numbers. If I know the forces, I can decipher the samples. I can figure out how much gold is underground.”

Srivastava realized that the same logic could be applied to the lottery. The apparent randomness of the scratch ticket was just a facade, a mathematical lie. And this meant that the lottery system might actually be solvable, just like those mining samples. “At the time, I had no intention of cracking the tickets,” he says. He was just curious about the algorithm that produced the numbers. Walking back from the gas station with the chips and coffee he’d bought with his winnings, he turned the problem over in his mind. By the time he reached the office, he was confident that he knew how the software might work, how it could precisely control the number of winners while still appearing random. “It wasn’t that hard,” Srivastava says. “I do the same kind of math all day long.”

That afternoon, he went back to work. The thrill of winning had worn off; he forgot about his lunchtime adventure. But then, as he walked by the gas station later that evening, something strange happened. “I swear I’m not the kind of guy who hears voices,” Srivastava says. “But that night, as I passed the station, I heard a little voice coming from the back of my head. I’ll never forget what it said: ‘If you do it that way, if you use that algorithm, there will be a flaw. The game will be flawed. You will be able to crack the ticket. You will be able to plunder the lottery.’”