views:

58

answers:

1

I'm have trouble rearranging sequences so the amount of letters in the given original sequence are the same in the random generated sequences. For example:

If i have a string 'AAAC' I need that string rearranged randomly so the amount of A's and C's are the same.

+5  A: 
import random
chars = list("AAAC")
random.shuffle(chars)
return ''.join(chars)
KennyTM