int pow2J = 1 << (numDimensions - 1);
for (int j = 0; j < numDimensions; ++j) {
v.set(j, 1.0 / pow2J * (i & pow2J));
pow2J >>= 1;
}
mean.add(new Centroid(i, v, 1));
rowSamplers.add(new MultiNormal(distributionRadius, v));
}
// Sample the requested number of data points.
List<Centroid> data = Lists.newArrayListWithCapacity(numDatapoints);
for (int i = 0; i < numDatapoints; ++i) {
data.add(new Centroid(i, rowSamplers.get(i % pow2N).sample(), 1));
}
return new Pair<List<Centroid>, List<Centroid>>(data, mean);
}