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

That's the one. For the life of me I don't see how it works yet, but it does. Many thanks.

Replies are listed 'Best First'.
Re^3: Random data generation.
by almut (Canon) on Jun 26, 2010 at 13:39 UTC

    As there are only two of each character in the set which is shuffled ((@chars) x 2), there can of course also only occur two in a row at maximum.

    OTOH, this technique doesn't allow more than two of any character in the result (like AACBAFFDCAEC), so it might introduce an unwanted bias... (you didn't explicitly say whether this is desired or not, and it cannot be inferred from your valid samples).

      You're right. No, it isn't the one. It won't do at all.

        It sounds like you're still looking for a solution. Is there a problem with my solution? If so, let me know so I can fix it.
Re^3: Random data generation.
by ikegami (Patriarch) on Jun 26, 2010 at 15:39 UTC

    It's not random. Not even close. For example, you'll never have three of the same character anywhere in the string.

    I don't know if it matters, but it only works if $len <= @set*2