Simplify random coordinate setting
This commit is contained in:
parent
09e28e744e
commit
00fe7d12b7
11
proarbeit.py
11
proarbeit.py
|
@ -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__":
|
||||||
|
|
Loading…
Reference in New Issue