--- jsr166/src/test/jtreg/util/Random/DistinctSeeds.java 2003/11/07 01:35:36 1.1 +++ jsr166/src/test/jtreg/util/Random/DistinctSeeds.java 2003/11/08 07:46:41 1.2 @@ -1,5 +1,5 @@ /** - * @test 1.1 03/11/06 + * @test %I% %E% * @bug 4949279 * @summary Independent instantiations of Random() have distinct seeds. */ @@ -8,9 +8,10 @@ import java.util.Random; public class DistinctSeeds { public static void main(String[] args) throws Exception { - // Strictly speaking, it is possible for these to be equal, - // but the likelihood should be *extremely* small. - if (new Random().nextLong() == new Random().nextLong()) - throw new RuntimeException("Random seeds not unique."); + // Strictly speaking, it is possible for these to randomly fail, + // but the probability should be *extremely* small (< 2**-63). + if (new Random().nextLong() == new Random().nextLong() || + new Random().nextLong() == new Random().nextLong()) + throw new RuntimeException("Random() seeds not unique."); } }