Skip to content

Commit

Permalink
Pull random x,y coord calculations in a bit
Browse files Browse the repository at this point in the history
Trying to solve issue #1
  • Loading branch information
Jonathan Penn committed Oct 28, 2012
1 parent d3d317a commit 88cddfb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions UIAutoMonkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ UIAutoMonkey = {

randomX: function() {
// Returns a random X coordinate within the screen rectangle
var range = this.target().rect().size.width;
return Math.floor(Math.random() * 10000) % range;
var range = this.target().rect().size.width - 1;
return Math.floor(Math.random() * 10000) % range + 1;
},

randomY: function() {
// Returns a random Y coordinate within the screen rectangle
var range = this.target().rect().size.height;
return Math.floor(Math.random() * 10000) % range;
var range = this.target().rect().size.height - 1;
return Math.floor(Math.random() * 10000) % range + 1;
},

randomTapCount: function() {
Expand Down

0 comments on commit 88cddfb

Please sign in to comment.