final int len = 10; // length of values array
final double mu = 0; // mean of test data
final double sigma = 5; // std dev of test data
double[] values = new double[len];
double[] weights = new double[len];
RandomData randomData = new RandomDataImpl();
// Fill weights array with random int values between 1 and 5
int[] intWeights = new int[len];
for (int i = 0; i < len; i++) {
intWeights[i] = randomData.nextInt(1, 5);
weights[i] = intWeights[i];
}
// Fill values array with random data from N(mu, sigma)
// and fill valuesList with values from values array with
// values[i] repeated weights[i] times, each i
List<Double> valuesList = new ArrayList<Double>();
for (int i = 0; i < len; i++) {
double value = randomData.nextGaussian(mu, sigma);
values[i] = value;
for (int j = 0; j < intWeights[i]; j++) {
valuesList.add(new Double(value));
}
}