class RandomCoordinateGenerator { private definedCoordinates = []; public generate (minX : number, maxX : number, minY : number, maxY : number) { let coordinates : Array; do { coordinates = [randomRange(minX, maxX), randomRange(minY, maxY)]; } while (this.definedCoordinates.includes(coordinates.join(";"))); this.definedCoordinates.push(coordinates.join(";")); return coordinates; } }