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