public Particle<XYZVector> create() {
filled+=Math.pow(box.volume()/nParticles, 1d/box.dimension());
double xpos=filled%box.x;
double ypos=((filled-(filled%box.x))/Math.pow(nParticles, 1d/box.dimension()))%box.y; //this would be easier with integers...
double zpos=(filled-(ypos*box.x)-xpos)/Math.pow(nParticles, 2d/box.dimension());
return new Particle<XYZVector>(new XYZVector(xpos, ypos, zpos), new XYZVector(Math.random()*2-1, Math.random()*2-1, Math.random()*2-1), m);
}