---SOLVED---
I'm using x and y multipliers to make this actor's movement ridiculously random, but I'm getting strange results. This is the part of the code I am having problems with. It is executed every act cycle. By the way, all variables are doubles, not ints.
I would expect the output to be between 1.0 and 2.0, or -2.0 and -1.0. Instead it's outputting:
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
-1.0,-1.0
You get the idea. There appears to be no randomness happening? What could be wrong?
xMultiplier = (Greenfoot.getRandomNumber(1000)/1000) + 1; yMultiplier = (Greenfoot.getRandomNumber(1000)/1000) + 1; if(Greenfoot.getRandomNumber(3) <= 3) { xMultiplier = xMultiplier * (-1); } if(Greenfoot.getRandomNumber(3) <= 3) { yMultiplier = yMultiplier * (-1); } System.out.println(xMultiplier + "," + yMultiplier); //For debugging purposes