generalise shared prng functionality to interfaces

This commit is contained in:
2024-08-23 09:13:42 +10:00
parent 39d46da7f7
commit efd9905f5b
3 changed files with 29 additions and 7 deletions

View File

@ -6,3 +6,18 @@ public protocol RandomProvider {
mutating func next() -> Output
}
public protocol RandomSeedable {
associatedtype SeedType: FixedWidthInteger
init(seed: SeedType)
mutating func seed(_ value: SeedType)
}
public protocol RandomStateAccess {
associatedtype StateType
var state: StateType { get set }
init(state: StateType)
}