Staging
v0.8.1
https://github.com/python/cpython
Revision 2e1beeac2e61e5b93afd89fc7798599dbf1618d2 authored by Guido van Rossum on 11 June 1996, 18:40:02 UTC, committed by Guido van Rossum on 11 June 1996, 18:40:02 UTC
hacks for Windows and DOS here already :-( ).
1 parent 8bac546
Raw File
Tip revision: 2e1beeac2e61e5b93afd89fc7798599dbf1618d2 authored by Guido van Rossum on 11 June 1996, 18:40:02 UTC
Add a hack for Solaris threads (why not, there are zillions of
Tip revision: 2e1beea
rand.py
# 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)]
back to top