aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-04-22 08:56:03 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-04-22 08:56:03 +0000
commit17bc2f507035b9abde2e35e09437040dbf76327e (patch)
tree62dee10d0cce5d60b0d2739578b46fac55be15f6
parentMerge branch 'releases/1.7' (diff)
generate-alt-random: use {width,height} + 1 in randrange()
When randomizing the sixel width and height, use width/height + 1 in the call to randrange(). This ensures the width/height is never 0, and that the maximum width/height is half the window size, not slightly less than that.
-rwxr-xr-xscripts/generate-alt-random-writes.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/generate-alt-random-writes.py b/scripts/generate-alt-random-writes.py
index 63becdcf..8aa4835c 100755
--- a/scripts/generate-alt-random-writes.py
+++ b/scripts/generate-alt-random-writes.py
@@ -176,7 +176,7 @@ def main():
else:
# Random origin in upper left quadrant
last_pos = random.randrange(lines // 2) + 1, random.randrange(cols // 2) + 1
- last_size = random.randrange(height // 2), random.randrange(width // 2)
+ last_size = random.randrange((height + 1) // 2), random.randrange((width + 1) // 2)
out.write(f'\033[{last_pos[0]};{last_pos[1]}H')
six_height, six_width = last_size