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 n开发者_StackOverfloweed that string rearranged randomly so the amount of A's and C's are the same.
import random
chars = list("AAAC")
random.shuffle(chars)
return ''.join(chars)
精彩评论