mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
Add implementation of shuffle on IdentifiedArray (#254)
* add shuffle * Update Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift * Update IdentifiedArrayTests.swift Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
This commit is contained in:
committed by
GitHub
parent
86843a4dcc
commit
fffefb9c22
@@ -190,6 +190,15 @@ where ID: Hashable {
|
||||
try areInIncreasingOrder(self.dictionary[$0]!, self.dictionary[$1]!)
|
||||
}
|
||||
}
|
||||
|
||||
public mutating func shuffle<T>(using generator: inout T) where T : RandomNumberGenerator {
|
||||
ids.shuffle(using: &generator)
|
||||
}
|
||||
|
||||
public mutating func shuffle() {
|
||||
var rng = SystemRandomNumberGenerator()
|
||||
self.shuffle(using: &rng)
|
||||
}
|
||||
}
|
||||
|
||||
extension IdentifiedArray: CustomDebugStringConvertible {
|
||||
|
||||
Reference in New Issue
Block a user