Skip to content

Instantly share code, notes, and snippets.

@blubberdiblub
Created January 20, 2017 07:36
Show Gist options
  • Save blubberdiblub/f6cf2c5dd0b91aeb4f9ee877627799d3 to your computer and use it in GitHub Desktop.
Save blubberdiblub/f6cf2c5dd0b91aeb4f9ee877627799d3 to your computer and use it in GitHub Desktop.
Program producing some random output and errors in random intervals.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import sys
import time
for i in range(1000):
time.sleep(random.betavariate(0.2, 1))
if random.random() < 0.1:
print("Error #{}".format(random.randint(1, 99)), file=sys.stderr)
else:
print(random.randrange(1000000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment