[cvs] / jsr166 / src / main / java / util / SplittableRandom.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/SplittableRandom.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3, Thu Jul 11 03:31:26 2013 UTC revision 1.4, Thu Jul 11 13:40:42 2013 UTC
# Line 311  Line 311 
311           * evenly divisible by the range. The loop rejects candidates           * evenly divisible by the range. The loop rejects candidates
312           * computed from otherwise over-represented values.  The           * computed from otherwise over-represented values.  The
313           * expected number of iterations under an ideal generator           * expected number of iterations under an ideal generator
314           * varies from 1 to 2, depending on the bound.           * 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           * 4. Otherwise, the range cannot be represented as a positive
321           * long.  Repeatedly generate unbounded longs until obtaining           * long.  The loop repeatedly generates unbounded longs until
322           * a candidate meeting constraints (with an expected number of           * obtaining a candidate meeting constraints (with an expected
323           * iterations of less than two).           * number of iterations of less than two).
324           */           */
325    
326          long r = mix64(nextSeed());          long r = mix64(nextSeed());
# Line 869  Line 873 
873    
874          public int characteristics() {          public int characteristics() {
875              return (Spliterator.SIZED | Spliterator.SUBSIZED |              return (Spliterator.SIZED | Spliterator.SUBSIZED |
876                      Spliterator.ORDERED | Spliterator.NONNULL |                      Spliterator.NONNULL | Spliterator.IMMUTABLE);
                     Spliterator.IMMUTABLE);  
877          }          }
878    
879          public boolean tryAdvance(IntConsumer consumer) {          public boolean tryAdvance(IntConsumer consumer) {
# Line 924  Line 927 
927    
928          public int characteristics() {          public int characteristics() {
929              return (Spliterator.SIZED | Spliterator.SUBSIZED |              return (Spliterator.SIZED | Spliterator.SUBSIZED |
930                      Spliterator.ORDERED | Spliterator.NONNULL |                      Spliterator.NONNULL | Spliterator.IMMUTABLE);
                     Spliterator.IMMUTABLE);  
931          }          }
932    
933          public boolean tryAdvance(LongConsumer consumer) {          public boolean tryAdvance(LongConsumer consumer) {
# Line 980  Line 982 
982    
983          public int characteristics() {          public int characteristics() {
984              return (Spliterator.SIZED | Spliterator.SUBSIZED |              return (Spliterator.SIZED | Spliterator.SUBSIZED |
985                      Spliterator.ORDERED | Spliterator.NONNULL |                      Spliterator.NONNULL | Spliterator.IMMUTABLE);
                     Spliterator.IMMUTABLE);  
986          }          }
987    
988          public boolean tryAdvance(DoubleConsumer consumer) {          public boolean tryAdvance(DoubleConsumer consumer) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8