Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- import random
- range = int(sys.argv[1])
- v = 0
- vmin = 0
- vmax = 0
- i = 0
- while vmax - vmin < range:
- v += random.randint(0, 1) * 2 - 1
- if v < vmin:
- vmin = v
- if v > vmax:
- vmax = v
- i += 1
- print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement