updated sampler for grid.cpp