Lines Matching refs:seed

33  * pseudorandom numbers. The class uses a 48-bit seed, which is
38 * seed, and the same sequence of method calls is made for each, they
78 private final AtomicLong seed;
86 * the seed of the random number generator to a value very likely
108 * Creates a new random number generator using a single {@code long} seed.
109 * The seed is the initial value of the internal state of the pseudorandom
112 * <p>The invocation {@code new Random(seed)} is equivalent to:
115 * rnd.setSeed(seed);}</pre>
117 * @param seed the initial seed
120 public Random(long seed) {
122 this.seed = new AtomicLong(initialScramble(seed));
125 this.seed = new AtomicLong();
126 setSeed(seed);
130 private static long initialScramble(long seed) {
131 return (seed ^ multiplier) & mask;
135 * Sets the seed of this random number generator using a single
136 * {@code long} seed. The general contract of {@code setSeed} is
139 * created with the argument {@code seed} as a seed. The method
141 * atomically updating the seed to
142 * <pre>{@code (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1)}</pre>
147 * happens to use only 48 bits of the given seed. In general, however,
149 * argument as a seed value.
151 * @param seed the initial seed
153 synchronized public void setSeed(long seed) {
154 this.seed.set(initialScramble(seed));
168 * implemented by class {@code Random} by atomically updating the seed to
169 * <pre>{@code (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1)}</pre>
171 * <pre>{@code (int)(seed >>> (48 - bits))}.</pre>
185 AtomicLong seed = this.seed;
187 oldseed = seed.get();
189 } while (!seed.compareAndSet(oldseed, nextseed));
326 * Because class {@code Random} uses a seed with only 48 bits,
518 * @serialField seed long
519 * seed for random computations
526 new ObjectStreamField("seed", Long.TYPE),
540 // The seed is read in as {@code long} for
542 long seedVal = fields.get("seed", -1L);
545 "Random: invalid seed");
560 // The seed is serialized as a long for historical reasons.
561 fields.put("seed", seed.get());
569 // Support for resetting seed while deserializing
575 (Random.class.getDeclaredField("seed"));