Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Linear congruential generator in python

def rng(m=2**32, a=1103515245, c=12345):
    rng.current = (a*rng.current + c) % m
    return rng.current/m

# setting the seed
rng.current = 1
for i in range(10):
  rng()
Source by people.duke.edu #
 
PREVIOUS NEXT
Tagged: #Linear #congruential #generator #python
ADD COMMENT
Topic
Name
2+5 =