nmin and nmax should be integer