24
24
25
25
package org .openscience .cdk .graph .invariant ;
26
26
27
- import com .google .common .primitives .Longs ;
28
27
import org .junit .Test ;
29
28
30
- import java .util .HashSet ;
31
29
import java .util .Random ;
32
- import java .util .Set ;
33
30
34
31
import static org .hamcrest .CoreMatchers .is ;
35
32
import static org .hamcrest .MatcherAssert .assertThat ;
@@ -115,11 +112,9 @@ public void mergeSort() {
115
112
116
113
// random (unique) values in random order
117
114
Random rnd = new Random ();
118
- Set <Long > values = new HashSet <Long >();
119
- while (values .size () < n )
120
- values .add (rnd .nextLong ());
121
-
122
- long [] prev = Longs .toArray (values );
115
+ long [] prev = new long [n ];
116
+ for (int i =0 ; i <n ; i ++)
117
+ prev [i ] = rnd .nextLong ();
123
118
124
119
// ident array
125
120
int [] vs = new int [n ];
@@ -141,11 +136,9 @@ public void mergeSort_range() {
141
136
142
137
// random (unique) values in random order
143
138
Random rnd = new Random ();
144
- Set <Long > values = new HashSet <Long >();
145
- while (values .size () < n )
146
- values .add (rnd .nextLong ());
147
-
148
- long [] prev = Longs .toArray (values );
139
+ long [] prev = new long [n ];
140
+ for (int i =0 ; i <n ; i ++)
141
+ prev [i ] = rnd .nextLong ();
149
142
150
143
// ident array
151
144
int [] vs = new int [n ];
0 commit comments