Compare commits

...

1 Commits

Author SHA1 Message Date
00fe7d12b7
Simplify random coordinate setting 2020-07-28 15:36:10 +02:00

View File

@ -1,21 +1,20 @@
from mouse import get_position, move from mouse import get_position, move
from random import randint from secrets import randbelow
from time import sleep from time import sleep
def erratic_movement(screen_width, screen_height): def erratic_movement(screen_width, screen_height):
x, y = get_position()
move( move(
x + randint(-100, 100) % screen_width, y + randint(-100, 100) % screen_height, randbelow(screen_width), randbelow(screen_height),
) )
def main(): def main():
screen_width = 1920 screen_width = 800
screen_height = 1080 screen_height = 600
while True: while True:
erratic_movement(screen_width, screen_height) erratic_movement(screen_width, screen_height)
sleep(randint(2, 10)) sleep(randbelow(10))
if __name__ == "__main__": if __name__ == "__main__":