@@ 51-64 (lines=14) @@ | ||
48 | * @param int $amount |
|
49 | * @return static |
|
50 | */ |
|
51 | public function shuffle() |
|
52 | { |
|
53 | $shuffled = []; |
|
54 | ||
55 | $keys = array_keys($this->items); |
|
56 | ||
57 | shuffle($keys); |
|
58 | ||
59 | foreach ($keys as $key) { |
|
60 | $shuffled[$key] = $this->items[$key]; |
|
61 | } |
|
62 | ||
63 | return new static($shuffled); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Pad to the specified size with a value. |
@@ 23-36 (lines=14) @@ | ||
20 | * @param int $amount |
|
21 | * @return static |
|
22 | */ |
|
23 | public function shuffle() |
|
24 | { |
|
25 | $shuffled = []; |
|
26 | ||
27 | $keys = array_keys($this->items); |
|
28 | ||
29 | shuffle($keys); |
|
30 | ||
31 | foreach ($keys as $key) { |
|
32 | $shuffled[$key] = $this->items[$key]; |
|
33 | } |
|
34 | ||
35 | return new static($shuffled); |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Pad to the specified size with a value. |