My question is about how to stay in the loop that generates the new list until it fits the constraint, and only exit it if it does. After a rewrite of my original code, here is a slightly improved (but still wrong) version:
pastebin.com/X2i72jcm. The problem is not checking that they are equal, it is that once
boolean
is true, a new random sample is made, but that random sample still has a chance of including a repeat letter. But this loop will not catch the resampled's mistake.