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

Comparing jsr166/src/test/jtreg/util/Random/DistinctSeeds.java (file contents):
Revision 1.3 by dl, Mon Feb 19 00:24:17 2007 UTC vs.
Revision 1.7 by jsr166, Tue Mar 15 19:47:04 2011 UTC

# Line 1 | Line 1
1 /**
2 * @test %I% %E%
3 * @bug 4949279
4 * @summary Independent instantiations of Random() have distinct seeds.
5 */
6
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7 + /*
8 + * @test
9 + * @bug 4949279
10 + * @summary Independent instantiations of Random() have distinct seeds.
11 + */
12  
13   import java.util.Random;
14  
15   public class DistinctSeeds {
16      public static void main(String[] args) throws Exception {
17 <        // Strictly speaking, it is possible for these to randomly fail,
18 <        // but the probability should be *extremely* small (< 2**-63).
19 <        if (new Random().nextLong() == new Random().nextLong() ||
20 <            new Random().nextLong() == new Random().nextLong())
17 >        // Strictly speaking, it is possible for these to randomly fail,
18 >        // but the probability should be *extremely* small (< 2**-63).
19 >        if (new Random().nextLong() == new Random().nextLong() ||
20 >            new Random().nextLong() == new Random().nextLong())
21              throw new RuntimeException("Random() seeds not unique.");
22      }
23   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines