This is the code that I have been provided to work with for a draft lottery problem, where the user can input 7 numbers for the 'b' variable:
a = Range[45];
b = {1, 2, 3, 4, 5, 6, 7};
For[i = 1, i <= 200000000, i = i + 1,
If[Sort[RandomSample[a, 7]] == b, Print[i]]]
It would be appreciated if someone could explain the last two lines, as I understand the penultimate to be a list of numbers from one to 200 million, but unsure of the last line. I am not sure of what the output is meant to be, as I have gotten 3 nine digit numbers and 1 eight digit number. Is there also any reason that RandomSample was used rather than RandomChoice? I had believed this to mean that the output would not contain the same number more than once, but my current output of 4 numbers does have the same number multiple times in each number. Any soltutions, explanations or advice on either or all issues are greatly appreciated. Thanks a lot :))