in reply to Re: Random data generation.
in thread Random data generation.

You made the same error I did originally, you attempted to solve "no repeating characters" rather than "no more than two repeating characters".

Furthermore, your code never uses the last character of the set.