mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Initial revision
This commit is contained in:
parent
df79a1ee19
commit
c636014c43
47 changed files with 5492 additions and 0 deletions
12
Lib/rand.py
Normal file
12
Lib/rand.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Module '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)]
|
Loading…
Add table
Add a link
Reference in a new issue