<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.Random;



/* This class defines a random generator of page references.

 * It generates a random page number uniformly distributed between 0 and numPages.

 */

public class RandomReferenceGenerator extends ReferenceGenerator {

    Random random;

    

    /* This constructor initializes the random number generator with a random seed.

     */

    public RandomReferenceGenerator (int numPages) {

	super(numPages);

	random = new Random();

    }



    /* This method initializes the seed as specified. 

     */

    public final void init (long seed) {

	random.setSeed(seed);

    }



    /* This method generates a random reference uniformly distributed between 0 and numPages.

     */ 

    public final int nextReference () {

	return Math.abs(random.nextInt()%numPages);

    }

}

</pre></body></html>