From what I've read, it seems that they select a random sample of 50,000 - 55,000 winners from the pool of applicants worldwide. But from the statistics I've seen, the distribution is not uniformly random. My next guess is that they select a random sample of 50,000 - 55,000 winners, and then apply rejection sampling so that no country has more than 7% winners. My guess is probably not correct. What is the precise algorithm/procedure the U.S. States Department uses to arrive at the final selection?
Every year the U.S States Department randomly selected 50,000 applicants for the Green Visa lottery program. All applicants are selected randomly as a whole, for the number of visas allocated for that region, but with the limitation that no single country may receive more than 7% of the total diversity visas. That is the maximum number of applicants per country that can get a green visa is not more than 3,500.