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

Comparing jsr166/src/main/java/util/SplittableRandom.java (file contents):
Revision 1.3 by jsr166, Thu Jul 11 03:31:26 2013 UTC vs.
Revision 1.4 by dl, Thu Jul 11 13:40:42 2013 UTC

# Line 311 | Line 311 | public class SplittableRandom {
311           * evenly divisible by the range. The loop rejects candidates
312           * computed from otherwise over-represented values.  The
313           * expected number of iterations under an ideal generator
314 <         * varies from 1 to 2, depending on the bound.
314 >         * varies from 1 to 2, depending on the bound. The loop itself
315 >         * takes an unlovable form. Because the first candidate is
316 >         * already available, we need a break-in-the-middle
317 >         * construction, which is concisely but cryptically performed
318 >         * within the while-condition of a body-less for loop.
319           *
320           * 4. Otherwise, the range cannot be represented as a positive
321 <         * long.  Repeatedly generate unbounded longs until obtaining
322 <         * a candidate meeting constraints (with an expected number of
323 <         * iterations of less than two).
321 >         * long.  The loop repeatedly generates unbounded longs until
322 >         * obtaining a candidate meeting constraints (with an expected
323 >         * number of iterations of less than two).
324           */
325  
326          long r = mix64(nextSeed());
# Line 869 | Line 873 | public class SplittableRandom {
873  
874          public int characteristics() {
875              return (Spliterator.SIZED | Spliterator.SUBSIZED |
876 <                    Spliterator.ORDERED | Spliterator.NONNULL |
873 <                    Spliterator.IMMUTABLE);
876 >                    Spliterator.NONNULL | Spliterator.IMMUTABLE);
877          }
878  
879          public boolean tryAdvance(IntConsumer consumer) {
# Line 924 | Line 927 | public class SplittableRandom {
927  
928          public int characteristics() {
929              return (Spliterator.SIZED | Spliterator.SUBSIZED |
930 <                    Spliterator.ORDERED | Spliterator.NONNULL |
928 <                    Spliterator.IMMUTABLE);
930 >                    Spliterator.NONNULL | Spliterator.IMMUTABLE);
931          }
932  
933          public boolean tryAdvance(LongConsumer consumer) {
# Line 980 | Line 982 | public class SplittableRandom {
982  
983          public int characteristics() {
984              return (Spliterator.SIZED | Spliterator.SUBSIZED |
985 <                    Spliterator.ORDERED | Spliterator.NONNULL |
984 <                    Spliterator.IMMUTABLE);
985 >                    Spliterator.NONNULL | Spliterator.IMMUTABLE);
986          }
987  
988          public boolean tryAdvance(DoubleConsumer consumer) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines