Timeline for How do I generate a random string (of length X, a-z only) in Python?
Current License: CC BY-SA 2.5
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 18, 2016 at 11:27 | comment | added | ShadowRanger |
@Altaisoft: You're misunderstanding how sample works. It only draws any given character once, but it's not drawing in order. So abc and cba would be different outputs. Your test is only valid (would have expected huge numbers of overlaps) if you assume sample returns them in the same order they appeared in the original string, but since they can appear in any order, there are (26+7)! / 7! options; overlaps won't be common.
|
|
Jan 10, 2014 at 4:12 | comment | added | Anatoly Scherbakov | Neither of these code samples implies uniqueness. Here is a test: pastie.org/8619409 | |
Dec 24, 2009 at 10:39 | comment | added | u0b34a0f6ae |
FYI, string.lowercase is rarely more than ASCII however you set the locale in my experience. I'm just noting that there is no true variable for "current alphabet".
|
|
Dec 24, 2009 at 8:00 | history | answered | Alex Martelli | CC BY-SA 2.5 |