Created
April 30, 2020 17:44
-
-
Save jbn/a717c18ecd3cfabad8e8330224d44d79 to your computer and use it in GitHub Desktop.
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 numpy as np | |
n, syn, ack = 240, "SYN", "ACK" | |
k = n//4 | |
idx = sorted(zip(np.random.randint(0, n, k), np.random.choice([syn, ack], k))) | |
corruption = [] | |
for i in range(n): | |
while idx and idx[0][0] <= i: | |
corruption.append(list(idx.pop(0)[1])) | |
new_buf = [] | |
for msg in corruption[:]:| | |
print(msg.pop(0), end="") | |
if msg: | |
new_buf.append(msg) | |
else: | |
print("|", end="") | |
corruption = new_buf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment