@@ -152,7 +152,7 @@ struct Randomizer {
152
152
153
153
// move items
154
154
for _ in 0 ..< itemActionCount {
155
- if sections. count == 0 {
155
+ if sections. isEmpty {
156
156
continue
157
157
}
158
158
@@ -162,14 +162,12 @@ struct Randomizer {
162
162
( nextRng, randomValue) = nextRng. get_random ( )
163
163
let destinationSectionIndex = randomValue % sections. count
164
164
165
- let sectionItemCount = sections [ sourceSectionIndex] . numbers. count
166
-
167
- if sectionItemCount == 0 {
165
+ if sections [ sourceSectionIndex] . numbers. isEmpty {
168
166
continue
169
167
}
170
168
171
169
( nextRng, randomValue) = nextRng. get_random ( )
172
- let sourceItemIndex = randomValue % sectionItemCount
170
+ let sourceItemIndex = randomValue % sections [ sourceSectionIndex ] . numbers . count
173
171
174
172
( nextRng, randomValue) = nextRng. get_random ( )
175
173
@@ -185,21 +183,19 @@ struct Randomizer {
185
183
186
184
// delete items
187
185
for _ in 0 ..< itemActionCount {
188
- if sections. count == 0 {
186
+ if sections. isEmpty {
189
187
continue
190
188
}
191
189
192
190
( nextRng, randomValue) = nextRng. get_random ( )
193
191
let sourceSectionIndex = randomValue % sections. count
194
192
195
- let sectionItemCount = sections [ sourceSectionIndex] . numbers. count
196
-
197
- if sectionItemCount == 0 {
193
+ if sections [ sourceSectionIndex] . numbers. isEmpty {
198
194
continue
199
195
}
200
196
201
197
( nextRng, randomValue) = nextRng. get_random ( )
202
- let sourceItemIndex = randomValue % sectionItemCount
198
+ let sourceItemIndex = randomValue % sections [ sourceSectionIndex ] . numbers . count
203
199
204
200
if deleteItems {
205
201
nextUnusedItems. append ( sections [ sourceSectionIndex] . numbers. remove ( at: sourceItemIndex) )
@@ -211,7 +207,7 @@ struct Randomizer {
211
207
212
208
// move sections
213
209
for _ in 0 ..< sectionActionCount {
214
- if sections. count == 0 {
210
+ if sections. isEmpty {
215
211
continue
216
212
}
217
213
@@ -231,7 +227,7 @@ struct Randomizer {
231
227
232
228
// delete sections
233
229
for _ in 0 ..< sectionActionCount {
234
- if sections. count == 0 {
230
+ if sections. isEmpty {
235
231
continue
236
232
}
237
233
0 commit comments