Random
The Random module deals with random data generation including random number generation.
Data Generator
The DataGenerator class powers all of the random data generators.
Implementations
OSRandom: Provides a random data generator using a platform-specific method.
URandomprovides random data generation based on the/dev/urandomfile.
CryptoRandomfrom theCryptomodule provides cryptographically-secure random data using OpenSSL.
let random: DataGenerator ...let data = try random.generateData(bytes: 8)
Generate
DataGenerators are capable of generating random primitive types using the generate(_:) method.
let int = try OSRandom().generate(Int.self)print(int) // Int
