My toolkit to get random data.
let value = Random.int(in: -10...10).single()
let element = Random.element(in: [1,2,3,4,5]).single()
let arrangement = Random.shuffle(array).single()
let phones = Random.string(match: "[1][0-9]{10}").batch(count: 10)
let trial = Random.sample.bernoulli(successProp: 0.25).single()
-
Generating one random value, or an array of random values in same type.
-
Generating random value in basic types, such as int, double, bool.
-
Generating random case from given CaseIterable enumeration.
-
Generating random tuples from several collections.
-
Generating nil or value randomly.
-
Generating success value or failure error randomly in Result<Success, Failure> type.
-
Generating random value in other common types in Foundation & CoreGraphics frameworks.
-
Generating random pattern strings.
-
Choosing element, index, slice, range from collections, and shuffling collections.
-
Sampling values satisfied common distributions, such as Bernoulli, Geometric, etc.
0.1.0
You can install Randoman by using Cocoapods:
pod 'Randoman'
-
iOS 10.0+
-
Xcode 10.0+
-
Swift 5.0+