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

Comparing jsr166/src/jsr166y/ThreadLocalRandom.java (file contents):
Revision 1.12 by jsr166, Wed Aug 19 17:44:45 2009 UTC vs.
Revision 1.13 by jsr166, Wed Aug 19 17:52:50 2009 UTC

# Line 9 | Line 9 | package jsr166y;
9   import java.util.Random;
10  
11   /**
12 < * A random number generator isolated to the current Thread.  Like the
12 > * A random number generator isolated to the current thread.  Like the
13   * global {@link java.util.Random} generator used by the {@link
14 < * java.lang.Math} class, a ThreadLocalRandom is initialized with an
15 < * internally generated seed that may not otherwise be modified. When
16 < * applicable, use of ThreadLocalRandom rather than shared Random
17 < * objects in concurrent programs will typically encounter much less
18 < * overhead and contention.  ThreadLocalRandoms are particularly
19 < * appropriate when multiple tasks (for example, each a {@link
20 < * ForkJoinTask}), use random numbers in parallel in thread pools.
14 > * java.lang.Math} class, a {@code ThreadLocalRandom} is initialized
15 > * with an internally generated seed that may not otherwise be
16 > * modified. When applicable, use of {@code ThreadLocalRandom} rather
17 > * than shared {@code Random} objects in concurrent programs will
18 > * typically encounter much less overhead and contention.  Use of
19 > * {@code ThreadLocalRandom} is particularly appropriate when multiple
20 > * tasks (for example, each a {@link ForkJoinTask}) use random numbers
21 > * in parallel in thread pools.
22   *
23   * <p>Usages of this class should typically be of the form:
24   * {@code ThreadLocalRandom.current().nextX(...)} (where
25   * {@code X} is {@code Int}, {@code Long}, etc).
26   * When all usages are of this form, it is never possible to
27 < * accidently share ThreadLocalRandoms across multiple threads.
27 > * accidently share a {@code ThreadLocalRandom} across multiple threads.
28   *
29   * <p>This class also provides additional commonly used bounded random
30   * generation methods.
# Line 76 | Line 77 | public class ThreadLocalRandom extends R
77      }
78  
79      /**
80 <     * Returns the current Thread's ThreadLocalRandom.
80 >     * Returns the current thread's {@code ThreadLocalRandom}.
81       *
82 <     * @return the current Thread's ThreadLocalRandom
82 >     * @return the current thread's {@code ThreadLocalRandom}
83       */
84      public static ThreadLocalRandom current() {
85          return localRandom.get();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines