Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
seedrandom Namespace Reference

Functions

def getallchar
 
def getNumFromChar
 
def seedstring
 
def interleave
 
def rands
 
def rand
 
def seed
 

Variables

int _seed = 0
 
int RAND_MAX = 0x7fffffff
 
tuple allchar = getallchar()
 
tuple aye = allchar.find('a')
 
tuple AAYE = allchar.find('A')
 
tuple Uhun = allchar.find('0')
 
int totalnormchar = 26
 

Function Documentation

def seedrandom.getallchar ( )

Definition at line 3 of file seedrandom.py.

3 
4 def getallchar ():
5  rez = ""
6  for i in range(256):
7  rez += "%c"% i
return rez
def seedrandom.getNumFromChar (   c)

Definition at line 13 of file seedrandom.py.

13 
14 def getNumFromChar(c):
15  global allchar,aye,AAYE, Uhun
16  charnum=allchar.find(c)
17  if (charnum-aye<26):
18  charnum = charnum-aye
19  else:
20  if (charnum-AAYE<26):
21  charnum = charnum-AAYE+26
22  else:
23  if (charnum-Uhun<10):
24  charnum = charnum-Uhun+26+26
return charnum
def seedrandom.interleave (   slist)

Definition at line 38 of file seedrandom.py.

38 
39 def interleave (slist):
40  touch=1
41  index=0
42  rez=''
43  while (touch):
44  touch=0
45  for s in slist:
46  if len(s)>index:
47  touch=1
48  rez+=s[index]
49  index+=1
50  return rez
_seed=0
def seedrandom.rand ( )

Definition at line 60 of file seedrandom.py.

60 
61 def rand():
62  global _seed
63  _seed = rands (_seed)
return _seed
def seedrandom.rands (   intseed)

Definition at line 51 of file seedrandom.py.

51 
52 def rands(intseed):
53  global RAND_MAX
54  intseed = long( long(intseed) * long(1103515245) + long(12345))
55  intseed = long(intseed) %long(RAND_MAX)
56  try:
57  intseed=int(intseed)
58  except:
59  return intseed
return intseed
def seedrandom.seed (   seednum)

Definition at line 64 of file seedrandom.py.

64 
65 def seed (seednum):
66  global _seed
67  _seed = seednum
def seedrandom.seedstring (   stru)

Definition at line 25 of file seedrandom.py.

References getNumFromChar().

25 
26 def seedstring (stru):
27  num=long(0)
28  l=len (stru)
29  for i in range(l):
30  global totalnormchar,RAND_MAX
31  num+=long(getNumFromChar(stru[l-i-1]))
32  num*=long(totalnormchar);
33  num = (num % long(RAND_MAX))
34  try:
35  num = int(num)
36  except:
37  print 'warning'
return num

Variable Documentation

int _seed = 0

Definition at line 1 of file seedrandom.py.

tuple AAYE = allchar.find('A')

Definition at line 10 of file seedrandom.py.

tuple allchar = getallchar()

Definition at line 8 of file seedrandom.py.

tuple aye = allchar.find('a')

Definition at line 9 of file seedrandom.py.

int RAND_MAX = 0x7fffffff

Definition at line 2 of file seedrandom.py.

int totalnormchar = 26

Definition at line 12 of file seedrandom.py.

tuple Uhun = allchar.find('0')

Definition at line 11 of file seedrandom.py.