From 0b6179014da9e5998f4c5d5c8117e0726383b9d3 Mon Sep 17 00:00:00 2001 From: Jordi Arranz Date: Fri, 6 Jan 2023 16:10:15 +0000 Subject: [PATCH] Bug fix --- wsl-module/wsl.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wsl-module/wsl.py b/wsl-module/wsl.py index d6f9996..8559821 100644 --- a/wsl-module/wsl.py +++ b/wsl-module/wsl.py @@ -111,10 +111,11 @@ def make_payload_dist(dist_type, min_size, max_size): # Payload sizes are even integers uniformly distributed in [min_size, max_size] if dist_type == 'uniform': - size = random.uniform(min_size, max_size) + size = int(random.uniform(min_size, max_size)) + # Reject non even sizes while(size % 2) != 0: - size = random.uniform(min_size, max_size) + size = int(random.uniform(min_size, max_size)) return make_payload(size) @@ -125,7 +126,7 @@ def make_payload_dist(dist_type, min_size, max_size): size = int(rtnorm.rtnorm(min_size, max_size, sigma=σ, mu=μ, size=1)) # Reject non even sizes - while size % 2 != 0.0: + while(size % 2) != 0: size = int(rtnorm.rtnorm(min_size, max_size, sigma=σ, mu=μ, size=1)) return size