sample array calculation