Sometimes it is important. In the example below, we draw uniform variates over 1, 2 and then estimate the mean and the standard deviation, which we could compare with their theoretical values of 1. Next, we use set rngstate to restore the state to what it was before we generated y , and then we generate z. You might later want to reproduce the analysis, meaning you do not want to draw another random sample, but you want to draw the same random sample. First, I want to show you how I got the two formulas and why you must use the second formula for generating integer uniform deviates.
nest...