home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Komputer for Alle 2004 #2
/
K-CD-2-2004.ISO
/
OpenOffice Sv
/
f_0397
/
python-core-2.2.2
/
lib
/
lib-old
/
rand.py
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
Python Source
|
2003-07-18
|
276 b
|
14 lines
# Module 'rand'
# Don't use unless you want compatibility with C's rand()!
import whrandom
def srand(seed):
whrandom.seed(seed%256, seed/256%256, seed/65536%256)
def rand():
return int(whrandom.random() * 32768.0) % 32768
def choice(seq):
return seq[rand() % len(seq)]