Closed icyield closed 1 year ago
Good idea! Thanks for the input, definitely a valid oversight. For BSON 6 we could rely on the Swift 4.2 unified random integer API (in the standard library). For Linux randomness for the existing BSON (5.2) implementation we could use a PR. The second problem that comes to mind is that counter == random
under the circumstances you describe.
If a number of instance of an app are started in parallel there is a danger that if they start in the same second there can be duplicate objectIds generated.
Perhaps time in millisecs could be used.
Or is there a source of true random on linux (/dev/random)
if os(Linux)