5 |
|
*/ |
6 |
|
|
7 |
|
/* |
8 |
< |
* @test %I% %E% |
8 |
> |
* @test |
9 |
|
* @bug 4949279 |
10 |
|
* @summary Independent instantiations of Random() have distinct seeds. |
11 |
|
*/ |
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 |
|
} |