Mercurial > cpython-lru_cache-weakref
view Lib/rand.py @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | b29696e5c4d9 |
| children |
line wrap: on
line source
# 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)]
