The first element of the collection.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
Discussion
If the collection is empty, the value of this property is nil
.
The first element of the collection.
SDK
Framework
If the collection is empty, the value of this property is nil
.
func random Element() -> Element?
Returns a random element of the collection.
func random Element<T>(using: inout T) -> Element?
Returns a random element of the collection, using the given generator as a source for randomness.