# | Line 209 | Line 209 | public class CheckedListBash { | |
---|---|---|
209 | } | |
210 | ||
211 | static void AddRandoms(List s, int n) { | |
212 | < | for (int i=0; i<n; i++) { |
213 | < | int r = rnd.nextInt() % n; |
214 | < | Integer e = new Integer(r < 0 ? -r : r); |
212 | > | for (int i = 0; i < n; i++) { |
213 | > | Integer e = rnd.nextInt(n); |
214 | ||
215 | int preSize = s.size(); | |
216 | if (!s.add(e)) | |
217 | fail("Add failed."); | |
218 | int postSize = s.size(); | |
219 | < | if (postSize-preSize != 1) |
219 | > | if (postSize - preSize != 1) |
220 | fail("Add didn't increase size by 1."); | |
221 | } | |
222 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |