24 |
|
*/ |
25 |
|
|
26 |
|
package java.util; |
27 |
+ |
|
28 |
|
import java.io.*; |
29 |
|
import java.util.concurrent.atomic.AtomicLong; |
30 |
|
import sun.misc.Unsafe; |
151 |
|
* |
152 |
|
* @param seed the initial seed |
153 |
|
*/ |
154 |
< |
synchronized public void setSeed(long seed) { |
154 |
> |
public synchronized void setSeed(long seed) { |
155 |
|
this.seed.set(initialScramble(seed)); |
156 |
|
haveNextNextGaussian = false; |
157 |
|
} |
295 |
|
* @throws IllegalArgumentException if n is not positive |
296 |
|
* @since 1.2 |
297 |
|
*/ |
297 |
– |
|
298 |
|
public int nextInt(int n) { |
299 |
|
if (n <= 0) |
300 |
|
throw new IllegalArgumentException("n must be positive"); |
368 |
|
* range {@code 0.0f} (inclusive) to {@code 1.0f} (exclusive), is |
369 |
|
* pseudorandomly generated and returned. All 2<font |
370 |
|
* size="-1"><sup>24</sup></font> possible {@code float} values |
371 |
< |
* of the form <i>m x </i>2<font |
371 |
> |
* of the form <i>m x </i>2<font |
372 |
|
* size="-1"><sup>-24</sup></font>, where <i>m</i> is a positive |
373 |
|
* integer less than 2<font size="-1"><sup>24</sup> </font>, are |
374 |
|
* produced with (approximately) equal probability. |
493 |
|
* standard deviation {@code 1.0} from this random number |
494 |
|
* generator's sequence |
495 |
|
*/ |
496 |
< |
synchronized public double nextGaussian() { |
496 |
> |
public synchronized double nextGaussian() { |
497 |
|
// See Knuth, ACP, Section 3.4.1 Algorithm C. |
498 |
|
if (haveNextNextGaussian) { |
499 |
|
haveNextNextGaussian = false; |
551 |
|
/** |
552 |
|
* Save the {@code Random} instance to a stream. |
553 |
|
*/ |
554 |
< |
synchronized private void writeObject(ObjectOutputStream s) |
554 |
> |
private synchronized void writeObject(ObjectOutputStream s) |
555 |
|
throws IOException { |
556 |
|
|
557 |
|
// set the values of the Serializable fields |