The function uses dojitter to jitter the gridpoint vector by (amount*d) . The endpoints are fixed to be zero and one, and the corresponding jx values to x[2] and x[length(x)-1] are randomised again in the intervals [0,x[2]+amount*d] and [x[length(x)-1]-amount*d,1] respectively.
#create grid vector#xgrid<-seq(0,1,length=51)
#xgrid
##a regularly-spaced grid on [0,1]#modjitter(xgrid,1)
##jitters xgrid with a maximum change of .02, keeping endpoints of zero and one