main/src/georegression/geometry/UtilPoint2D_F64.java
public static List<Point2D_F64> randomNorm( Point2D_F64 mean , DMatrix covariance , int count ,
												Random rand ,
												@Nullable List<Point2D_F64> output )
	{
		if( output == null )
			output = new ArrayList<>();

		// extract values of covariance
		double cxx = covariance.get(0,0);
		double cxy = covariance.get(0,1);
		double cyy = covariance.get(1,1);

		// perform cholesky decomposition
		double sxx = Math.sqrt(cxx);
		double sxy = cxy/cxx;
		double syy = Math.sqrt(cyy-sxy*sxy);

		for (int i = 0; i < count; i++) {
			Point2D_F64 p = new Point2D_F64();

			double x = rand.nextGaussian();
			double y = rand.nextGaussian();

			p.x = mean.x + sxx*x + sxy*y;
			p.y = mean.y + sxy*x + syy*y;

			output.add(p);
		}

		return output;
	}
public static List<Point2D_F64> randomNorm( Point2D_F64 mean , DMatrix covariance , int count ,
												Random rand ,
												@Nullable List<Point2D_F64> output )
	{
		if( output == null )
			output = new ArrayList<>();

		// extract values of covariance
		double cxx = covariance.get(0,0);
		double cxy = covariance.get(0,1);
		double cyy = covariance.get(1,1);

		// perform cholesky decomposition
		double sxx = Math.sqrt(cxx);
		double sxy = cxy/cxx;
		double syy = Math.sqrt(cyy-sxy*sxy);

		for (int i = 0; i < count; i++) {
			Point2D_F64 p = new Point2D_F64();

			double x = rand.nextGaussian();
			double y = rand.nextGaussian();

			p.x = mean.x + sxx*x + sxy*y;
			p.y = mean.y + sxy*x + syy*y;

			output.add(p);
		}

		return output;
	}
public static List < Point2D_F64 > randomNorm ( Point2D_F64 mean , DMatrix covariance , int count , Random rand , @ Nullable List < Point2D_F64 > output ) { if ( output == null ) output = new ArrayList <> ( ) ; // extract values of covariance double cxx = covariance . get ( 0 , 0 ) ; double cxy = covariance . get ( 0 , 1 ) ; double cyy = covariance . get ( 1 , 1 ) ; // perform cholesky decomposition double sxx = Math . sqrt ( cxx ) ; double sxy = cxy / cxx ; double syy = Math . sqrt ( cyy - sxy * sxy ) ; for ( int i = 0 ; i < count ; i ++ ) { Point2D_F64 p = new Point2D_F64 ( ) ; double x = rand . nextGaussian ( ) ; double y = rand . nextGaussian ( ) ; p . x = mean . x + sxx * x + sxy * y ; p . y = mean . y + sxy * x + syy * y ; output . add ( p ) ; } return output ; }
Randomly generates points from the specified normal distribution
@param mean (Input) mean
@param covariance (Output) 2x2 covariance matrix
@param count (Input) Number of points to create
@param rand (Input) Random number generator
@param output (Output) Optional storage for points. If null a new list is created
@return List containing points.
Randomly generates points from the specified normal distribution