ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jdk7/java/util/Random.java
(Generate patch)

Comparing jsr166/src/jdk7/java/util/Random.java (file contents):
Revision 1.1 by dl, Sun Dec 16 20:55:09 2012 UTC vs.
Revision 1.5 by jsr166, Sun Jan 18 20:17:32 2015 UTC

# Line 24 | Line 24
24   */
25  
26   package java.util;
27 +
28   import java.io.*;
29   import java.util.concurrent.atomic.AtomicLong;
30   import sun.misc.Unsafe;
# Line 150 | Line 151 | class Random implements java.io.Serializ
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      }
# Line 294 | Line 295 | class Random implements java.io.Serializ
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");
# Line 368 | Line 368 | class Random implements java.io.Serializ
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&nbsp;x&nbsp</i>2<font
371 >     * of the form <i>m&nbsp;x&nbsp;</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.
# Line 493 | Line 493 | class Random implements java.io.Serializ
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;
# Line 551 | Line 551 | class Random implements java.io.Serializ
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines