Skip to content

Commit 6a0a187

Browse files
committed
Pull Random instance creation out of loop
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1789013 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9e8eec7 commit 6a0a187

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ public void testCorrectness() throws Exception {
5454

5555
checkOnBytes("hello world!".getBytes("UTF-8"), false);
5656

57+
final Random random1 = new Random();
58+
final Random random2 = new Random();
5759
for (int i = 0; i < 10000; i++) {
58-
byte randomBytes[] = new byte[new Random().nextInt(2048)];
59-
new Random().nextBytes(randomBytes);
60+
byte randomBytes[] = new byte[random1.nextInt(2048)];
61+
random2.nextBytes(randomBytes);
6062
checkOnBytes(randomBytes, false);
6163
}
6264

0 commit comments

Comments
 (0)