The setstate function handles restarting and changing random- number generators. Once you initialize a state, the setstate function allows rapid switching between state arrays. The array defined by state is used for further random-number generation until the initstate function is called or the setstate function is called again. The setstate function returns a pointer to the previous state array. After initialization, you can restart a state array at a different point in one of two ways: o Use the initstate function, with the desired seed, state array, and size of the array. o Use the setstate function, with the desired state, followed by the srandom function with the desired seed. The advantage of using both functions is that you do not have to save the state array size once you initialize it. See also initstate, srandom, and random.