Returns a random value within the specified range, using the given generator as a source for randomness.
- Xcode 10.0+
- Swift Standard Library
The range in which to create a random value.
rangemust be finite and non-empty.
The random number generator to use when creating the new random value.
A random value within the bounds of
Use this method to generate a floating-point value within a specific range when you are using a custom random number generator. This example creates three new values in the range
random(in: static method chooses a random value from a continuous uniform distribution in
range, and then converts that value to the nearest representable value in this type. Depending on the size and span of
range, some concrete values may be represented more frequently than others.