Another area which I think needs further discussion (unless I'm missing something) is that the proposal doesn't mention any protocol requirements concerning the state or seeding of PRNGs, ie:
// The proposal currently only has:
protocol RandomNumberGenerator : AnyObject {
func next() -> UInt64
}
// But I think it should also have (or at least mention) something like:
protocol PseudoRandomNumberGenerator : RandomNumberGenerator {
associatedtype State
init?(state: State) // <-- Failable since eg Xoroshiro128+ can't have a state which is everywhere zero.
init(seed: UInt64) // <-- All PRNG types must be seedable by an UInt64, and each unique UInt64 value must result in a unique state ... effectively putting a min 64 bit state requirement on supported PRNGs... this requires more discussion ...
}
While I agree that the default generator should be cryptographically secure (and a non-seedable RNG), I think many use cases will need seedable, stateful PRNGs, and I don't see the point of leaving the API for their state and seeding unrestricted and undiscussed.
If the idea is to separate the PRNG-part into an additional proposal, I think it would be better to discuss it now and include it in this proposal, in order to ensure that the RNG-part (having otherwise been designed in isolation) doesn't end up negatively impacting the design of the PRNG-part.