The following source code generates random numbers between 0 and 1:
def nextRandom(seed):
m = 233280 # modulus
a = 9301 # multiplier
c = 49297 # increment
x0 = seed # start-value
return ((a * x0 + c) % m)/m
What modification can I apply to this source code to generate random numbers between -1 and 1?
Aucun commentaire:
Enregistrer un commentaire