Staging
v0.5.1
https://github.com/python/cpython
Revision 24260ec91623c18569225229d5becb852010ae2c authored by cvs2svn on 28 August 1995, 03:12:57 UTC, committed by cvs2svn on 28 August 1995, 03:12:57 UTC
1 parent d4901c8
Raw File
Tip revision: 24260ec91623c18569225229d5becb852010ae2c authored by cvs2svn on 28 August 1995, 03:12:57 UTC
This commit was manufactured by cvs2svn to create tag 'r13beta1'.
Tip revision: 24260ec
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