|
30 | 30 | import java.nio.charset.UnsupportedCharsetException; |
31 | 31 | import java.util.Arrays; |
32 | 32 | import java.util.Random; |
33 | | - |
| 33 | +import java.util.concurrent.ThreadLocalRandom; |
34 | 34 | import org.apache.commons.codec.DecoderException; |
35 | 35 | import org.apache.commons.codec.EncoderException; |
36 | 36 | import org.junit.Assert; |
@@ -422,12 +422,11 @@ public void testEncodeClassCastException() { |
422 | 422 |
|
423 | 423 | @Test |
424 | 424 | public void testEncodeDecodeHexCharArrayRandom() throws DecoderException, EncoderException { |
425 | | - final Random random = new Random(); |
426 | 425 |
|
427 | 426 | final Hex hex = new Hex(); |
428 | 427 | for (int i = 5; i > 0; i--) { |
429 | | - final byte[] data = new byte[random.nextInt(10000) + 1]; |
430 | | - random.nextBytes(data); |
| 428 | + final byte[] data = new byte[ThreadLocalRandom.current().nextInt(10000) + 1]; |
| 429 | + ThreadLocalRandom.current().nextBytes(data); |
431 | 430 |
|
432 | 431 | // static API |
433 | 432 | final char[] encodedChars = Hex.encodeHex(data); |
@@ -455,10 +454,9 @@ public void testEncodeDecodeHexCharArrayRandom() throws DecoderException, Encode |
455 | 454 |
|
456 | 455 | @Test |
457 | 456 | public void testEncodeDecodeHexCharArrayRandomToOutput() throws DecoderException, EncoderException { |
458 | | - final Random random = new Random(); |
459 | 457 | for (int i = 5; i > 0; i--) { |
460 | | - final byte[] data = new byte[random.nextInt(10000) + 1]; |
461 | | - random.nextBytes(data); |
| 458 | + final byte[] data = new byte[ThreadLocalRandom.current().nextInt(10000) + 1]; |
| 459 | + ThreadLocalRandom.current().nextBytes(data); |
462 | 460 |
|
463 | 461 | // lower-case |
464 | 462 | final char[] lowerEncodedChars = new char[data.length * 2]; |
|
0 commit comments