next(upperBound:)
Returns a random value that is less than the given upper bound.
Declaration
mutating func next<T>(upperBound: T) -> T where T : FixedWidthInteger, T : UnsignedIntegerParameters
- upperBound:
The upper bound for the randomly generated value. Must be non-zero.
Return Value
A random value of T in the range 0..<upperBound. Every value in the range 0..<upperBound is equally likely to be returned.
Discussion
Use this method when you need random binary data to generate another value. If you need an integer value within a specific range, use the static random(in:using:) method on that integer type instead of this method.