Random - package DataStructures; / / / / / / / / / / / /...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
package DataStructures; // Random class // // CONSTRUCTION: with (a) no initializer or (b) an integer // that specifies the initial state of the generator // // ******************PUBLIC OPERATIONS********************* // Return a random number according to some distribution: // int randomInt( ) --> Uniform, 1 to 2^31-1 // int random0_1( ) --> Uniform, 0 to 1 // int randomInt( int low, int high ) --> Uniform low. .high // long randomLong( long low, long high ) --> Uniform low. .high // void permute( Object [ ] a ) --> Randomly permutate /** * Random number class, using a 31-bit * linear congruential generator. * Note that java.util contains a class Random, * so watch out for name conflicts. * @author Mark Allen Weiss */ public class Random { private static final int A = 48271; private static final int M = 2147483647; private static final int Q = M / A; private static final int R = M % A; /** * Construct this Random object with * initial state obtained from system clock. */ public Random( )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/22/2011 for the course CSC 532 taught by Professor Dr.gursaranadhar during the Spring '07 term at University of North Carolina Wilmington.

Page1 / 3

Random - package DataStructures; / / / / / / / / / / / /...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online