public Vector next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Vector result = type == VectorType.SPARSE ? new SparseVector(numItems) : new DenseVector(numItems);
result.assign(new UnaryFunction(){
@Override
public double apply(double arg1) {
return random.nextDouble();
}
});