complete prange
use global var to save maxp and minp