I am trying to make a mouse movement human-like, because the normal robot class is extremely un-human. When i try to run the above code, the mouse does not move to the right location, and is awfully buggy. Any tips? Thanks!

Thanks Norn for your reply-
I forgot to include that this was a method that you can call like this:
moveMouse(int x, int y);
So the "right location" in this case are the parameters passed on to the method. For example, i pass on the parameters to be '500,500'; The method should move the mouse to that spot. Instead, the mouse path unpredictably moves.

I don't see anything that guarantees the mouse will ever stop moving and end up where you want it in any reasonable number of time. In your while loop, you are always adding or subtracting 4, except when you enter the random portion and you add 1. Given enough time (on the order of minutes it looks like), it should eventually hit the right spot as long as nothing else changes the pointer location. My guess is you are calling this method from multiple threads that are all trying to move the pointer around and interfereing with eachother.

I don't see anything that guarantees the mouse will ever stop moving and end up where you want it in any reasonable number of time. In your while loop, you are always adding or subtracting 4, except when you enter the random portion and you add 1. Given enough time (on the order of minutes it looks like), it should eventually hit the right spot as long as nothing else changes the pointer location. My guess is you are calling this method from multiple threads that are all trying to move the pointer around and interfereing with eachother.

Thanks for your reply-
This is not the case though, as this is all ran on a single thread. There is only one instance where i run it.