https://github.com/python/cpython
Raw File
Tip revision: 99bbd18067083380b13a153c52fe342dbff21bc5 authored by cvs2svn on 12 October 1995, 10:34:31 UTC
This commit was manufactured by cvs2svn to create tag 'release13'.
Tip revision: 99bbd18
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