Returns a random value within the specified range.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
Parameters
range
The range in which to create a random value.
Return Value
A random value within the bounds of range
.
Discussion
Use this method to generate an integer within a specific range. This example creates three new values in the range 1...100
.
This method is equivalent to calling random(in:
, passing in the system’s default random generator.