Timeline for How do I generate a random string (of length X, a-z only) in Python?
Current License: CC BY-SA 2.5
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 17, 2016 at 14:29 | comment | added | ShadowRanger |
@Federico: Unless you use random.SystemRandom() , which should be as cryptographically secure as the OS supports. In modules that need cryptographic randomness, I often do: import random , random = random.SystemRandom() to replace the module with an instance of the class that provides OS crypto-randomness. SystemRandom is the random.Random API, with randomness provided by os.urandom instead of Mersenne Twister (os.urandom is backed by stuff like Window's CryptGenRandom , UNIX-like /dev/urandom , etc.).
|
|
Jun 23, 2013 at 21:14 | comment | added | Federico | Just keep in mind that any sequence generated by the random module is not cryptographically secure. | |
Dec 24, 2009 at 9:28 | comment | added | Evan Fosmark |
CytokineStorm, as of Python 3.x, range() behaves the same as xrange() .
|
|
Dec 24, 2009 at 8:10 | comment | added | Zach B | Nice use of generator expressions. But while we're saving memory, might as well use xrange instead of range. | |
Dec 24, 2009 at 7:55 | vote | accept | TIMEX | ||
Dec 24, 2009 at 7:54 | history | answered | Ignacio Vazquez-Abrams | CC BY-SA 2.5 |