fork(7) download
  1. import random
  2.  
  3. a = [0] * 11
  4.  
  5. v = 5
  6.  
  7. for i in range(10000):
  8. v += random.randint(0, 4) - 2
  9. if v < 0:
  10. v = 0
  11. elif 10 < v:
  12. v = 10
  13. a[v] += 1
  14.  
  15. for i in range(10):
  16. print str(a[i])
Success #stdin #stdout 0.05s 10632KB
stdin
Standard input is empty
stdout
1226
744
971
888
890
879
904
876
874
673