getPosition() {
    this.random = Math.random();
    this.vector.x = this.x1 + this.random * this.length * Math.cos(this.gradient);
    this.vector.y = this.y1 + this.random * this.length * Math.sin(this.gradient);

    return this.vector;
  }
Gets a random position on the line.
@returns {Vector2D} A vector representing the random position.