Skip to content

Commit

Permalink
simplify createRandomX and createRandomY in RatioNode, #83
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jun 15, 2019
1 parent 4913f16 commit 9d15a5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/common/view/RatioNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ define( function( require ) {

// Creates a random {number} x-coordinate inside some {Bounds2} bounds. Integer values improve Canvas performance.
function createRandomX( bounds ) {
return Math.floor( bounds.x + ( phet.joist.random.nextDouble() * bounds.getWidth() ) );
return phet.joist.random.nextIntBetween( bounds.minX, bounds.maxX );
}

// Creates a random {number} y-coordinate inside some {Bounds2} bounds. Integer values improve Canvas performance.
function createRandomY( bounds ) {
return Math.floor( bounds.y + ( phet.joist.random.nextDouble() * bounds.getHeight() ) );
return phet.joist.random.nextIntBetween( bounds.minY, bounds.maxY );
}

// Computes the {number} number of H3O+ molecules for some {number} pH.
Expand Down

0 comments on commit 9d15a5d

Please sign in to comment.