def RandomString (length,distribution):
string = ""
for t in distribution:
((t[1])/length) * t[1] += string
return shuffle (string)
This returns a syntax error as described in the title. In this example, distribution
is a list of tuples, with each tuple containing a letter, and its distribution, with all the distributions from the list adding up to 100, for example:
[("a",50),("b",20),("c",30)]
And length
is the length of the string that you want.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…