Created
May 8, 2020 15:43
-
-
Save emrantalukder/f7aaf7564b119e804d272c9b850d9b07 to your computer and use it in GitHub Desktop.
randomization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from pprint import pprint | |
| n = 100 | |
| event = 10 | |
| data = [] | |
| seen_events = 0 | |
| for i in range(n): | |
| t = random.expovariate(.2) | |
| c = random.expovariate(.2) | |
| status = t > c | |
| if seen_events > event: | |
| status = False | |
| status_code = 0 | |
| if status: | |
| seen_events = seen_events + 1 | |
| status_code = 1 | |
| data.append([t, c, status_code]) | |
| pprint(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment