Simulator/src/model/map/shapes/PathShape.java
/**
	 * Generates a position inside the shape.
	 * 
	 * @param randomGenerator
	 *            The random generator.
	 * @return The position.
	 */
Generates a position inside the shape.

@param randomGenerator
The random generator.
@return The position.
Generates a position inside the shape . @param randomGenerator The random generator . @return The position .
public Position generatePosition(RandomPlus randomGenerator) {
		Rectangle r = getBounds();
		float x = -1, y = -1;
		int count = 0;
		while (!contains(x, y)) {
			x = (float) (r.getX() + 1 + (r.getWidth() - 2) * randomGenerator.nextFloat());
			y = (float) (r.getY() + 1 + (r.getHeight() - 2) * randomGenerator.nextFloat());
			count++;
			if (count == 100)
				break;
		}
		return new Position(x, y);
	}
public Position generatePosition ( RandomPlus randomGenerator ) { Rectangle r = getBounds ( ) ; float x = - 1 , y = - 1 ; int count = 0 ; while ( ! contains ( x , y ) ) { x = ( float ) ( r . getX ( ) + 1 + ( r . getWidth ( ) - 2 ) * randomGenerator . nextFloat ( ) ) ; y = ( float ) ( r . getY ( ) + 1 + ( r . getHeight ( ) - 2 ) * randomGenerator . nextFloat ( ) ) ; count ++ ; if ( count == 100 ) break ; } return new Position ( x , y ) ; }
Generates a position inside the shape.
Generates a position inside the shape .
// preventing infinite loops from happening.