mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
4044b6fa99
commit
17bc2f5070
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue