projects
/
OpenSPARC-T2-DV
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV]
/
tools
/
src
/
nas,5.n2.os.2
/
lib
/
python
/
lib
/
python2.4
/
lib-old
/
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
)]