--- jsr166/src/jsr166y/ThreadLocalRandom.java 2009/01/12 20:46:29 1.2 +++ jsr166/src/jsr166y/ThreadLocalRandom.java 2009/03/19 06:50:01 1.3 @@ -18,7 +18,7 @@ import java.util.*; * contention. ThreadLocalRandoms are particularly appropriate when * multiple tasks (for example, each a {@link ForkJoinTask}), use * random numbers in parallel in thread pools. - * + * *
Usages of this class should typically be of the form:
* ThreadLocalRandom.current().nextX(...)
(where
* X
is Int
, Long
, etc).
@@ -37,7 +37,7 @@ public class ThreadLocalRandom extends R
/**
* The random seed. We can't use super.seed
*/
- private long rnd;
+ private long rnd;
/**
* Initialization flag to permit the first and only allowed call
@@ -65,7 +65,7 @@ public class ThreadLocalRandom extends R
/**
* Constructor called only by localRandom.initialValue.
- * We rely on the fact that the superclass no-arg constructor
+ * We rely on the fact that the superclass no-arg constructor
* invokes setSeed exactly once to initialize.
*/
ThreadLocalRandom() {
@@ -83,9 +83,9 @@ public class ThreadLocalRandom extends R
/**
* Throws UnsupportedOperationException. Setting seeds in this
* generator is unsupported.
- * @throw UnsupportedOperationException always
+ * @throws UnsupportedOperationException always
*/
- public void setSeed(long seed) {
+ public void setSeed(long seed) {
if (initialized)
throw new UnsupportedOperationException();
initialized = true;
@@ -126,10 +126,10 @@ public class ThreadLocalRandom extends R
// iteration (at most 31 of them but usually much less),
// randomly choose both whether to include high bit in result
// (offset) and whether to continue with the lower vs upper
- // half (which makes a difference only if odd).
+ // half (which makes a difference only if odd).
long offset = 0;
while (n >= Integer.MAX_VALUE) {
- int bits = next(2);
+ int bits = next(2);
long half = n >>> 1;
long nextn = ((bits & 2) == 0)? half : n - half;
if ((bits & 1) == 0)
@@ -183,4 +183,4 @@ public class ThreadLocalRandom extends R
return nextDouble() * (bound - least) + least;
}
-}
\ No newline at end of file
+}