src/share/classes/java/util/Random.java

Print this page

        

*** 75,87 **** * (The specs for the methods in this class describe the ongoing * computation of this value.) */ private final AtomicLong seed; ! private final static long multiplier = 0x5DEECE66DL; ! private final static long addend = 0xBL; ! private final static long mask = (1L << 48) - 1; /** * Creates a new random number generator. This constructor sets * the seed of the random number generator to a value very likely * to be distinct from any other invocation of this constructor. --- 75,87 ---- * (The specs for the methods in this class describe the ongoing * computation of this value.) */ private final AtomicLong seed; ! private static final long multiplier = 0x5DEECE66DL; ! private static final long addend = 0xBL; ! private static final long mask = (1L << 48) - 1; /** * Creates a new random number generator. This constructor sets * the seed of the random number generator to a value very likely * to be distinct from any other invocation of this constructor.
*** 283,293 **** * @param n the bound on the random number to be returned. Must be * positive. * @return the next pseudorandom, uniformly distributed {@code int} * value between {@code 0} (inclusive) and {@code n} (exclusive) * from this random number generator's sequence ! * @exception IllegalArgumentException if n is not positive * @since 1.2 */ public int nextInt(int n) { if (n <= 0) --- 283,293 ---- * @param n the bound on the random number to be returned. Must be * positive. * @return the next pseudorandom, uniformly distributed {@code int} * value between {@code 0} (inclusive) and {@code n} (exclusive) * from this random number generator's sequence ! * @throws IllegalArgumentException if n is not positive * @since 1.2 */ public int nextInt(int n) { if (n <= 0)