SE-0202, as accepted, introduces a type, Random
, as the default source of random numbers on each platform.
As @bzamayo outlines here, the name Random
for this default source is misleading, and would probably be better named DefaultRandomNumberGenerator
.
The core team agrees, so we're opening up a thread to discuss before accepting this amendment.
One open question is the naming of the getter for an instance of the type. Currently it is Random.default
. However, renaming Random
leads to the rather clunky DefaultRandomNumberGenerator.default
. Benjamin suggests .shared
. However, in all current implementations, this is not strictly speaking a shared instance – it is instead a getter/setter for a fresh instance each time. This doesn't actually have a cost, since the type has no actual size (the type is just a vehicle for calling an OS function), but needs to be done this way because using:
is taken inout
.
Any suggestions for better naming gratefully received.