KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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.
Tags (comma-separated)
Save Edits
Cancel