SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> a=128
  2. >>> c=0
  3. >>> m=509
  4. >>> n=500
  5. >>> seed = 10
  6. >>> for i in range (1,n):
  7.     new_seed=(a*seed+c)%m
  8.     seed = new_seed
  9.     print new_seed
  10.    
  11. >>> a=269
  12. >>> c=0
  13. >>> m=2048
  14. >>> n=500
  15. >>> seed = 10
  16. >>> for i in range (1,n):
  17.     new_seed=(a*seed+c)%m
  18.     seed = new_seed
  19.     print new_seed
  20.    
  21. import matplotlib.pyplot as plt
  22. import random
  23. x = []
  24. a,seed,c,m,n = 128,10,0,509,500
  25. for i in range (1,n):
  26.    new_seed=(a*seed+c)%m
  27.    seed = new_seed
  28.    x.append( new_seed)
  29.  
  30.  
  31. a,seed,c,m,n = 269,10,0,2048,500
  32. y= []
  33. for i in range (1,n):
  34.    new_seed=(a*seed+c)%m
  35.    seed = new_seed
  36.    y.append( new_seed)
  37. plt.plot(x,y)
  38. plt.show()
  39.    
  40. xlist = []
  41. for i in xrange(n):
  42.     new_seed = # generate the number
  43.     xlist.append(new_seed)
  44.    
  45. xlist = [generate_number(...) for i in xrange(n)]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top