SHARE
TWEET

Untitled

a guest Jan 24th, 2013 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import random
  4. import collections
  5.  
  6. Z = 3
  7. A = 4
  8.  
  9. counter = collections.Counter()
  10. s = random.randint(0,A-1)
  11. for i in range(1,1000000):
  12.     u = random.randint(0,A-1)
  13.     r = u + s
  14.     while r >= Z:
  15.         r -= Z
  16.     counter[r] += 1
  17.     s = r
  18.  
  19.  
  20.  
  21. for i in range(0,Z):
  22.     print (i, counter[i])
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