returns a random Vertex that represents a point on the unit circle

@return vertex
491921
public static final Vector3D randVertex2d() {
        float theta = random((float)(Math.PI*2.0));
        return new Vector3D(Math.cos(theta),Math.sin(theta));
    }
256536
public function createRandomized($minDistance = -0.005, $maxDistance = 0.005)
    {
        $newCoordinates = Geo::calculateNewCoordinates($this->latitude, $this->longitude, Random::randomFloat($minDistance, $maxDistance), rand(0,360));
        $newAltitude    = $this->altitude + round(Random::randomFloat(-2, 2), 2);
        $newAccuracy    = mt_rand(3, 10);
        return new self($newCoordinates[0], $newCoordinates[1], $newAltitude, $newAccuracy);
    }
1108351
public Circle set (double x, double y, double radius) {
        this.x = x;
        this.y = y;
        this.radius = radius;
        return this;
    }
504033
@Override
    public INDArray rand(int[] shape, float min, float max, org.nd4j.linalg.api.rng.Random rng) {
        //ensure shapes that wind up being scalar end up with the write shape
        if (shape.length == 1 && shape[0] == 0) {
            shape = new int[] {1, 1};
        }
        return Nd4j.getDistributions().createUniform(min, max).sample(shape);
    }
250223
public Instance sample(Random random) {
		// Create sample in hypersphere coordinates
		//get the center through getCenter so subclass have a chance
		double[] center = getCenter();

		final int dimensions = center.length;

		final double sin[] = new double[dimensions - 1];
		final double cos[] = new double[dimensions - 1];
		final double length = random.nextDouble() * getRadius();

		double lastValue = 1.0;
		for (int i = 0; i < dimensions-1; i++) {
			double angle = random.nextDouble() * 2 * Math.PI;
			sin[i] = lastValue * Math.sin( angle ); // Store cumulative values
			cos[i] = Math.cos( angle );
			lastValue = sin[i];
		}

		// Calculate cartesian coordinates
		double res[] = new double[dimensions];

		// First value uses only cosines
		res[0] = center[0] + length*cos[0];

		// Loop through 'middle' coordinates which use cosines and sines
		for (int i = 1; i < dimensions-1; i++) {
			res[i] = center[i] + length*sin[i-1]*cos[i];
		}

		// Last value uses only sines
		res[dimensions-1] = center[dimensions-1] + length*sin[dimensions-2];

		return new DenseInstance(1.0, res);
	}
123128
public static Polygon newRandom(final int length, final Random random) {
		require.positive(length);
		final Polygon p = new Polygon(length);

		p._data[0] = random.nextFloat(); // r
		p._data[1] = random.nextFloat(); // g
		p._data[2] = random.nextFloat(); // b
		p._data[3] = max(0.2F, random.nextFloat()*random.nextFloat()); // a

		float px = 0.5F;
		float py = 0.5F;
		for (int k = 0; k < length; k++) {
			p._data[4 + 2*k] = px = clamp(px + random.nextFloat() - 0.5F);
			p._data[5 + 2*k] = py = clamp(py + random.nextFloat() - 0.5F);
		}
		return p;
	}
261484
def random(magnitude=1):
        
        theta = random.uniform(0, 2 * math.pi)
        return magnitude * Vector(math.cos(theta), math.sin(theta))
1313825
public final Point2D getXY() {
		if (isEmptyImpl())
			throw new GeometryException(
					"This operation should not be performed on an empty geometry.");

		Point2D pt = new Point2D();
		pt.setCoords(m_attributes[0], m_attributes[1]);
		return pt;
	}
711058
public function createVertices($n)
    {
        $vertices = array();
        if (is_int($n) && $n >= 0) {
            for ($id = $this->getNextId(), $n += $id; $id < $n; ++$id) {
                $vertices[$id] = new Vertex($this, $id);
            }
        } elseif (is_array($n)) {
            // array given => check to make sure all given IDs are available (atomic operation)
            foreach ($n as $id) {
                if (!is_int($id) && !is_string($id)) {
                    throw new InvalidArgumentException('All Vertex IDs have to be of type integer or string');
                } elseif ($this->vertices->hasVertexId($id)) {
                    throw new OverflowException('Given array of Vertex IDs contains an ID that already exists. Given IDs must be unique');
                } elseif (isset($vertices[$id])) {
                    throw new InvalidArgumentException('Given array of Vertex IDs contain duplicate IDs. Given IDs must be unique');
                }

                // temporary marker to check for duplicate IDs in the array
                $vertices[$id] = false;
            }

            // actually create all requested vertices
            foreach ($n as $id) {
                $vertices[$id] = new Vertex($this, $id);
            }
        } else {
            throw new InvalidArgumentException('Invalid number of vertices given. Must be non-negative integer or an array of Vertex IDs');
        }

        return new Vertices($vertices);
    }
423450
public static function roundedRectangle(Point $corner, $width, $height, $radius, $ccw = false)
	{
		$points = new Points($corner, false);
		$points->addPoint($corner)->translateX($width - $radius);
		$points->addPoint($corner)->translate($width, $radius);
		$points->addPoint($corner)->translate($width, $height - $radius);
		$points->addPoint($corner)->translate($width - $radius, $height);
		$points->addPoint($corner)->translate($radius, $height);
		$points->addPoint($corner)->translateY($height - $radius);
		$points->addPoint($corner)->translateY($radius);
		$points->addPoint($corner)->translateX($radius);
		$points->reverseIfCcw($ccw);
		return $points;
	}
1349658
public float getBitangentZ(int vertex) {
        if (!hasTangentsAndBitangents()) {
            throw new IllegalStateException("mesh has no bitangents");
        }
        
        checkVertexIndexBounds(vertex);
        
        return m_bitangents.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
    }
1062365
public static Vertex newB()
    {
        return new Vertex(Predefine.TAG_BIGIN, " ", new CoreDictionary.Attribute(Nature.begin, Predefine.MAX_FREQUENCY / 10), CoreDictionary.getWordID(Predefine.TAG_BIGIN));
    }
508477
public float getNormalZ(int vertex) {
        if (!hasNormals()) {
            throw new IllegalStateException("mesh has no normals");
        }
        
        checkVertexIndexBounds(vertex);
        
        return m_normals.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
    }
677924
public double random() {
    long z = next();
    int exponentMag = 4;
    double resolution = 1e8;
    double x = ((z / 2) % resolution) / resolution;
    double y = z % exponentMag - exponentMag / 2;
    while (y > 1) {
      y--;
      x = 2;
    }
    while (y < -1) {
      y++;
      x /= 2;
    }
    return x;
  }
209033
public Vector getCentralPoint() {
		Vector arc = new Vector();
		if (empieza <= acaba) {
			addNode(arc, (empieza+acaba)/2.0);
		} else {
			addNode(arc, empieza);
			double alfa = 360-empieza;
			double beta = acaba;
			double an = alfa + beta;
			double mid = an/2.0;
			if (mid<=alfa) {
				addNode(arc, empieza+mid);
			} else {
				addNode(arc, mid-alfa);
			}
		}
		return arc;
	}
501595
public int rouletteWheel(BoundedRandomGenerator<Double> randomGenerator) {
    //Calculate the inverse sum
    double inverseSum = 0.0;
    for (int hypercube : hypercubes) {
      if (hypercube > 0) {
        inverseSum += 1.0 / (double) hypercube;
      }
    }

    //Calculate a random value between 0 and sumaInversa
    double random = randomGenerator.getRandomValue(0.0, inverseSum);
    int hypercube = 0;
    double accumulatedSum = 0.0;
    while (hypercube < hypercubes.length) {
      if (hypercubes[hypercube] > 0) {
        accumulatedSum += 1.0 / (double) hypercubes[hypercube];
      }

      if (accumulatedSum > random) {
        return hypercube;
      }

      hypercube++;
    }

    return hypercube;
  }
59608
public Object getVertex(final Point2D point2D) {
        final GraphElementAccessor<?, ?> pickSupport = _visualizationViewer.getPickSupport();

        @SuppressWarnings("rawtypes") final Layout graphLayout = _visualizationViewer.getModel().getGraphLayout();

        @SuppressWarnings("unchecked") final Object vertex = pickSupport.getVertex(graphLayout, point2D.getX(), point2D.getY());

        return vertex;
    }