Skip to content

Commit

Permalink
Update Shuffle operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jul 6, 2020
1 parent 74b621c commit e88562a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Operation/Shuffle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public function __invoke(): Closure

while ([] !== $data) {
$randomKey = array_rand($data);
$randomValue = $data[$randomKey];
unset($data[$randomKey]);

yield key($randomValue) => current($randomValue);
yield key($data[$randomKey]) => current($data[$randomKey]);
unset($data[$randomKey]);
}
};
}
Expand Down

0 comments on commit e88562a

Please sign in to comment.