Review fixes.

This commit is contained in:
Vladimir Chebotarev 2021-06-07 11:01:22 +03:00
parent 591c556321
commit f16dd06476

View File

@ -11,11 +11,11 @@ def gen_n_digit_number(n):
return random.randint(10**(n-1), 10**n-1)
sum_4 = 0
sum_in_4_column = 0
def gen_line():
global sum_4
global sum_in_4_column
columns = 4
row = []
@ -28,14 +28,16 @@ def gen_line():
row.append(1)
for i in range(columns - 1 - columns // 2):
add_number()
sum_4 += row[-1]
sum_in_4_column += row[-1]
line = ",".join(map(str, row)) + "\n"
return line.encode()
random.seed("Unstable server/1.0")
lines = b"".join((gen_line() for _ in range(500000))) + f"0,0,0,{-sum_4}\n".encode()
# Generating some "random" data and append a line which contains sum of numbers in column 4.
lines = b"".join((gen_line() for _ in range(500000))) + f"0,0,0,{-sum_in_4_column}\n".encode()
class RequestHandler(http.server.BaseHTTPRequestHandler):