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.1 by jsr166, Fri Nov 7 01:35:36 2003 UTC vs.
Revision 1.2 by jsr166, Sat Nov 8 07:46:41 2003 UTC

# Line 1 | Line 1
1   /**
2 < * @test 1.1 03/11/06
2 > * @test %I% %E%
3   * @bug 4949279
4   * @summary Independent instantiations of Random() have distinct seeds.
5   */
# Line 8 | Line 8 | import java.util.Random;
8  
9   public class DistinctSeeds {
10      public static void main(String[] args) throws Exception {
11 <        // Strictly speaking, it is possible for these to be equal,
12 <        // but the likelihood should be *extremely* small.
13 <        if (new Random().nextLong() == new Random().nextLong())
14 <            throw new RuntimeException("Random seeds not unique.");
11 >        // Strictly speaking, it is possible for these to randomly fail,
12 >        // but the probability should be *extremely* small (< 2**-63).
13 >        if (new Random().nextLong() == new Random().nextLong() ||
14 >            new Random().nextLong() == new Random().nextLong())
15 >            throw new RuntimeException("Random() seeds not unique.");
16      }
17   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines