Example usage for org.apache.commons.math.random UncorrelatedRandomVectorGenerator UncorrelatedRandomVectorGenerator

List of usage examples for org.apache.commons.math.random UncorrelatedRandomVectorGenerator UncorrelatedRandomVectorGenerator

Introduction

In this page you can find the example usage for org.apache.commons.math.random UncorrelatedRandomVectorGenerator UncorrelatedRandomVectorGenerator.

Prototype

public UncorrelatedRandomVectorGenerator(double[] mean, double[] standardDeviation,
        NormalizedRandomGenerator generator) 

Source Link

Document

Simple constructor.

Usage

From source file:com.tomgibara.cluster.CreateGaussianCross.java

private static void writeCluster(NormalizedRandomGenerator gen, double[] means, double[] deviations, int size,
        Writer writer) throws IOException {
    UncorrelatedRandomVectorGenerator c = new UncorrelatedRandomVectorGenerator(means, deviations, gen);
    for (int i = 0; i < size; i++) {
        double[] pt = c.nextVector();
        writer.write(String.format("%3.3f %3.3f%n", pt[0], pt[1]));
    }// ww  w  .  ja va 2  s . c  o  m
}

From source file:com.tomgibara.cluster.CreateUniformCircles.java

private static void writeCluster(NormalizedRandomGenerator gen, double[] means, double[] deviations, int size,
        Writer writer) throws IOException {
    UncorrelatedRandomVectorGenerator c = new UncorrelatedRandomVectorGenerator(means, deviations, gen);
    int count = 0;
    while (count < size) {
        double[] pt = c.nextVector();
        double x = pt[0] - means[0];
        double y = pt[1] - means[1];
        if (x * x + y * y > deviations[0] * deviations[1])
            continue;
        writer.write(String.format("%3.3f %3.3f%n", pt[0], pt[1]));
        count++;//w ww.j a v a 2 s  . c  om
    }
}