Generating a large random string

Chris Herborth chrish at cryptocard.com
Fri Feb 20 13:41:35 EST 2004


Sean Ross wrote:

> I'd be interested to see how
> 
> s = open("/dev/urandom").read(3000)
> 
> compares, and, if better, whether something similar can
> be done on Windows.

Works on my Windows boxes:

chris at chrish [501]: uname -a
CYGWIN_NT-5.1 chrish 1.5.7(0.109/3/2) 2004-01-30 19:32 i686 unknown unknown 
Cygwin
chris at chrish [502]: python
Python 2.3.3 (#1, Dec 30 2003, 08:29:25)
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> s = open("/dev/urandom").read(3000)
 >>> len(s)
3000
 >>> s[0]
']'
 >>> s[1]
'W'

;-)

-- 
Chris Herborth                                     chrish at cryptocard.com
Documentation Overlord, CRYPTOCard Corp.      http://www.cryptocard.com/
Never send a monster to do the work of an evil scientist.



More information about the Python-list mailing list