# \[Accepted\] SE-202: Random Unification

**URL:** <https://forums.swift.org/t/accepted-se-202-random-unification/12040>\
**Category:** Announcements\
**Created:** [April 20, 2018, 5:55pm UTC](https://forums.swift.org/t/accepted-se-202-random-unification/12040 "2018-04-20T17:55:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben-cohen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ben-cohen/32/296_2.png) [@ben-cohen](https://forums.swift.org/u/ben-cohen)\
**Post date:** [April 20, 2018, 5:55pm UTC](https://forums.swift.org/t/accepted-se-202-random-unification/12040/1 "2018-04-20T17:55:47Z")

</div>

The core team has **accepted** this [proposal](https://github.com/apple/swift-evolution/blob/master/proposals/0202-random-unification.md), with the following revisions:

- The method to get a random element from a collection should be named `Collection.randomElement() -> Element?`

- Since not all platforms will be able to provide an implementation of random that’s a cryptographically secure source of randomness, and that different platforms and users have different priorities, the decision of exactly which implementation to use for the default random number generator will be left to that platform's implementation of Swift. Where a platform vendor recommends certain sources of randomness, that should be preferred. Note that users should not rely on a particular implementation:  
we intentionally give the vendor permission to change the implementation in the future.

- The core team decided to keep the proposal's use of static methods. While the use of a free function may help with discoverability, it would lead to a proliferation of overloaded free functions for generating random values for other types. In particular, "full-width" random functions, such as for a `Bool`, would require overloading purely by return type with a free function.

- The random number generator argument should be taken `inout`. This is in keeping with other similar parts of the language (such as the recently accepted `Hasher`), will allow for value-typed stateful generators, and in the future, move-only generators.

Thanks again to everyone for participating in the review!
