{"id":2994,"url":"https://github.com/nvzqz/RandomKit","last_synced_at":"2025-08-06T16:32:05.692Z","repository":{"id":52267426,"uuid":"44030879","full_name":"nvzqz/RandomKit","owner":"nvzqz","description":"Random data generation in Swift","archived":false,"fork":false,"pushed_at":"2022-06-09T18:49:03.000Z","size":3640,"stargazers_count":1471,"open_issues_count":13,"forks_count":92,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-05-01T21:06:47.159Z","etag":null,"topics":["carthage","cocoapods","cross-platform","ios","linux","macos","math","protocol","random","random-generation","swift","swift-package-manager","testing","watchos"],"latest_commit_sha":null,"homepage":"https://nvzqz.github.io/RandomKit/docs/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvzqz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-10T22:35:12.000Z","updated_at":"2024-03-22T08:09:17.000Z","dependencies_parsed_at":"2022-11-29T13:20:25.398Z","dependency_job_id":null,"html_url":"https://github.com/nvzqz/RandomKit","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvzqz%2FRandomKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvzqz%2FRandomKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvzqz%2FRandomKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvzqz%2FRandomKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvzqz","download_url":"https://codeload.github.com/nvzqz/RandomKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228923758,"owners_count":17992574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","cocoapods","cross-platform","ios","linux","macos","math","protocol","random","random-generation","swift","swift-package-manager","testing","watchos"],"created_at":"2024-01-05T20:16:28.454Z","updated_at":"2024-12-09T16:31:19.980Z","avatar_url":"https://github.com/nvzqz.png","language":"Swift","readme":"[![RandomKit](https://github.com/nvzqz/RandomKit/raw/assets/banner.png)](https://github.com/nvzqz/RandomKit)\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platform-ios%20%7C%20macos%20%7C%20watchos%20%7C%20tvos%20%7C%20linux-lightgrey.svg\" alt=\"Platform\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/language-swift-orange.svg\" alt=\"Language: Swift\"\u003e\n    \u003cimg src=\"https://img.shields.io/cocoapods/dt/RandomKit.svg\" alt=\"downloads\"\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://cocoapods.org/pods/RandomKit\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/RandomKit.svg\" alt=\"CocoaPods - RandomKit\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://gitter.im/nvzqz/RandomKit?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\"\u003e\u003cimg src=\"https://badges.gitter.im/Join%20Chat.svg\" alt=\"GITTER: join chat\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codebeat.co/projects/github-com-nvzqz-randomkit\"\u003e\u003cimg src=\"https://codebeat.co/badges/256f6b2d-fd36-4b71-8bf0-b3cb31cb95ae\" alt=\"codebeat badge\"\u003e\u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-000000.svg\" alt=\"License\"\u003e\n    \u003ca href=\"https://nvzqz.github.io/RandomKit/docs/\"\u003e\u003cimg alt=\"Documented\" src=\"https://img.shields.io/badge/documented-%E2%9C%93-brightgreen.svg\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://www.patreon.com/nvzqz\"\u003e\n        \u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" alt=\"Become a Patron!\" height=\"35\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.paypal.me/nvzqz\"\u003e\n        \u003cimg src=\"https://buymecoffee.intm.org/img/button-paypal-white.png\" alt=\"Buy me a coffee\" height=\"35\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\nRandomKit is a Swift framework that makes random data generation simple and easy.\n\n- [Build Status](#build-status)\n- [Installation](#installation)\n    - [Compatibility](#compatibility)\n    - [Swift Package Manager](#install-using-swift-package-manager)\n    - [CocoaPods](#install-using-cocoapods)\n    - [Carthage](#install-using-carthage)\n- [Benchmark](#benchmark)\n- [Usage](#usage)\n    - [RandomGenerator](#randomgenerator)\n    - [Thread Safety](#thread-safety)\n    - [Protocols](#protocols)\n        - [Random](#random)\n        - [RandomInRange](#randominrange)\n        - [RandomInClosedRange](#randominclosedrange)\n        - [RandomToValue](#randomtovalue)\n        - [RandomThroughValue](#randomthroughvalue)\n        - [RandomRetrievable](#randomretrievable)\n        - [RandomRetrievableInRange](#randomretrievableinrange)\n        - [Shuffleable](#shuffleable)\n        - [UniqueShuffleable](#uniqueshuffleable)\n    - [Swift Types](#swift-types)\n        - [Integers](#integers)\n        - [Floating Point Numbers](#floating-point-numbers)\n        - [Bool](#bool)\n        - [String, Character, and UnicodeScalar](#string-character-and-unicodescalar)\n        - [Arrays](#arrays)\n        - [Arrays Benchmark](#arrays-benchmark)\n    - [Foundation Types](#foundation-types)\n        - [Date](#date)\n        - [Decimal](#decimal)\n        - [NSNumber](#nsnumber)\n        - [Cocoa and UIKit Types](#cocoa-and-uikit-types)\n            - [NSColor and UIColor](#nscolor-and-uicolor)\n    - [CoreGraphics Types](#coregraphics-types)\n        - [CGFloat](#cgfloat)\n        - [CGPoint](#cgpoint)\n        - [CGSize](#cgsize)\n        - [CGRect](#cgrect)\n        - [CGVector](#cgvector)\n- [Extra](#extra)\n    - [BigInt](#bigint)\n- [License](#license)\n\n## Build Status\n\n| Branch    | Status |\n| :-------: | :----: |\n| `master`  | [![Build Status](https://travis-ci.org/nvzqz/RandomKit.svg?branch=master)](https://travis-ci.org/nvzqz/RandomKit) |\n\n## Installation\n\n### Compatibility\n\n- Platforms:\n    - macOS 10.9+\n    - iOS 8.0+\n    - watchOS 2.0+\n    - tvOS 9.0+\n    - Linux\n- Xcode 8.0+\n- Swift 3.0.2+ \u0026 4.0\n\nRandomKit is possibly also compatible with FreeBSD, Android, and Windows\n(under Cygwin) but has not been tested for those platforms.\n\n### Install Using Swift Package Manager\nThe [Swift Package Manager](https://swift.org/package-manager/) is a\ndecentralized dependency manager for Swift.\n\n1. Add the project to your `Package.swift`.\n\n    ```swift\n    import PackageDescription\n\n    let package = Package(\n        name: \"MyAwesomeProject\",\n        dependencies: [\n            .Package(url: \"https://github.com/nvzqz/RandomKit.git\",\n                     majorVersion: 5)\n        ]\n    )\n    ```\n\n2. Import the RandomKit module.\n\n    ```swift\n    import RandomKit\n    ```\n\n### Install Using CocoaPods\n[CocoaPods](https://cocoapods.org/) is a centralized dependency manager for\nObjective-C and Swift. Go [here](https://guides.cocoapods.org/using/index.html)\nto learn more.\n\n1. Add the project to your [Podfile](https://guides.cocoapods.org/using/the-podfile.html).\n\n    ```ruby\n    use_frameworks!\n\n    pod 'RandomKit', '~\u003e 5.2.3'\n    ```\n\n    If you want to be on the bleeding edge, replace the last line with:\n\n    ```ruby\n    pod 'RandomKit', :git =\u003e 'https://github.com/nvzqz/RandomKit.git'\n    ```\n\n2. Run `pod install` and open the `.xcworkspace` file to launch Xcode.\n\n3. Import the RandomKit framework.\n\n    ```swift\n    import RandomKit\n    ```\n\n### Install Using Carthage\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency\nmanager for Objective-C and Swift.\n\n1. Add the project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).\n\n    ```\n    github \"nvzqz/RandomKit\"\n    ```\n\n2. Run `carthage update` and follow [the additional steps](https://github.com/Carthage/Carthage#getting-started)\n   in order to add RandomKit to your project.\n\n3. Import the RandomKit framework.\n\n    ```swift\n    import RandomKit\n    ```\n\n## Benchmark\n\nVarious components of RandomKit can be easily benchmarked by running `benchmark.sh`.\n\n```shell\n./benchmark.sh [FLAGS] [PROTOCOLS]\n```\n\nUse the `--help` flag for information regarding how to use it.\n\n**Note:** The default count is 10000000, which is A LOT if using the `--array` flag.\nThis can be changed by passing an argument into `--count` or `-c`.\n\n## Usage\n\nTry it out for yourself! Download the repo and open 'RandomKit.playground'.\n\n### RandomGenerator\n\nThe `RandomGenerator` protocol defines basic methods for generating primitive\nvalues and randomizing a buffer.\n\nAll provided types that conform to `RandomGenerator` have a static `default`\nvalue that can be passed as an `inout` argument to generation functions.\n\n```swift\nlet value = Int.random(using: \u0026Xoroshiro.default)\n```\n\n#### Available Generators\n\n- `ARC4Random`\n    - Because the symbols for the `arc4random` family of functions aren't\n      exported with Foundation on Linux and other platforms, they're dynamically\n      loaded at runtime.\n\n- `DeviceRandom`\n    - Reads from \"/dev/random\" or \"/dev/urandom\" as its source.\n\n- `MersenneTwister`\n\n- `Xoroshiro`\n\n- `Xorshift`\n\n- `XorshiftStar`\n\n- `ChaCha`\n\n#### SeedableRandomGenerator\n\n`SeedableRandomGenerator` is for types that can be seeded with some associated\n`Seed` type.\n\n#### RandomBytesGenerator\n\nThe `RandomBytesGenerator` protocol is for types that specialize in generating a\nspecific type that fills up a number of bytes. For example, `MersenneTwister`\nspecializes in generating `UInt64` while `Xorshift` generates `UInt32` values.\n\n### Thread Safety\n\nFor single-threaded programs, it is safe to use a global generator instance such\nas `Xoroshiro.default` as a source of randomness.\n\nFor multi-threaded programs, the thread-local instances should be used. This\nallows for different threads to use their own separate random generators without\na shared mutable state.\n\nIn the following example, `randomGenerator` is unique to each thread.\n\n```swift\nlet randomBytes = Xoroshiro.withThreadLocal { randomGenerator in\n    return [UInt8](randomCount: 1000, using: \u0026randomGenerator)\n}\n```\n\nThread-local generators are deallocated upon thread exit, so there's no need to\nworry about cleanup.\n\nIt's recommended to not call `withThreadLocal(_:)` or get the `threadLocal`\npointer each individual time it's needed. Retrieving the thread-local instance\nincurs avoidable overhead.\n\n```swift\n// Bad\nlet value = Int.random(using: \u0026Xoroshiro.threadLocal.pointee)\narray.shuffle(using: \u0026Xoroshiro.threadLocal.pointee)\n\n// Good\nlet threadLocal = Xoroshiro.threadLocal\nlet value = Int.random(using: \u0026threadLocal.pointee)\narray.shuffle(using: \u0026threadLocal.pointee)\n\n// Better\nXoroshiro.withThreadLocal { randomGenerator in\n    let value = Int.random(using: \u0026randomGenerator)\n    array.shuffle(using: \u0026randomGenerator)\n}\n```\n\nAs a shortcut, you can even apply a function directly as a parameter.\n\n```swift\nlet value = Xoroshiro.withThreadLocal(Int.random)\n```\n\nPrior to [v4.4.0](https://github.com/nvzqz/RandomKit/releases/tag/v4.4.0),\nthread safety could be achieved by instantiating a new seeded instance of a\ngiven `RandomGenerator` type. The problem with this is that unnecessary seeding\noccurs each time. With this, the generator is seeded once and can then be reused\nat later points.\n\nShortcuts to the reseeding version of a generator are also available:\n```swift\nXoroshiro.withThreadLocalReseeding {\n    ...\n}\n```\n\nWhich is *way* better than writing:\n```swift\nReseedingRandomGenerator.withThreadLocal(createdWith: { Xoroshiro.reseeding }) {\n    ...\n}\n```\n\n### Protocols\n\nRandomKit is very protocol-oriented, which gives it the ability to be very\nflexible and modular.\n\n#### Random\n\nA protocol for types that can generate random values using a `RandomGenerator`.\n\n#### RandomInRange\n\nA protocol for types that can generate optional random values within a range\nusing a `RandomGenerator`.\n\n```swift\nInt.random(in: 0 ..\u003c 0, using: \u0026randomGenerator) // nil\n```\n\n#### RandomInClosedRange\n\nA protocol for types that can generate random values within a closed range\nusing a `RandomGenerator`.\n\n```swift\nInt.random(in: -100 ... 100, using: \u0026randomGenerator) // -79\n```\n\n#### RandomToValue\n\nA protocol for types that can generate random values from a base value to\nanother value, noninclusive.\n\nThe base value for integers is 0. This means that calling `random(to:using:)` on\na negative value will yield a random negative value or zero whereas a positive\nvalue will yield a random positive value or zero.\n\nIf `value` == `randomBase`, `value` will be returned for `random(to:using:)`.\n\n```swift\nInt.random(to:  2, using: \u0026randomGenerator)  // Either 0 or 1\nInt.random(to:  0, using: \u0026randomGenerator)  // Always 0\nInt.random(to: 32, using: \u0026randomGenerator)  // 15\nInt.random(to: -5, using: \u0026randomGenerator)  // -3\n```\n\n#### RandomThroughValue\n\nA protocol for types that can generate random values from a base value through\nanother value, inclusive.\n\nThe same rules regarding the base value of `RandomToValue` apply to\n`RandomThroughValue`.\n\n#### RandomRetrievable\n\nA protocol for types whose instances can have random elements retrieved.\n\n```swift\n[\"Bob\", \"Cindy\", \"May\", \"Charles\", \"Javier\"].random(using: \u0026randomGenerator)  // \"Charles\"\n\n\"Hello\".characters.random(using: \u0026randomGenerator)  // \"e\"\n```\n\nSome Foundation types like `NSArray` conform to this protocol.\n\n#### RandomRetrievableInRange\n\nA protocol for types whose instances can have random elements retrieved from\nwithin a `Range\u003cIndex\u003e`.\n\n```swift\n[20, 37, 42].random(in: 1 ..\u003c 3, using: \u0026randomGenerator)  // Either 37 or 42\n```\n\n#### Shuffleable\n\nA protocol for types whose elements can be shuffled.\n\n```swift\n// Array\n[1, 2, 3, 4, 5].shuffled(using: \u0026randomGenerator)  // [3, 4, 1, 5, 2]\n\n// Dictionary\n[\"a\": 1, \"b\": 2, \"c\": 3].shuffled(using: \u0026randomGenerator)  // [\"a\": 3, \"b\": 1, \"c\": 2]\n```\n\nThe mutable counterpart of `shuffled(using:)` is `shuffle(using:)`.\n\nFor better `Array` shuffling performance, consider shuffling in-place with\n`shuffle(using:)`.\n\n#### UniqueShuffleable\n\nSimilar to `Shuffleable`, except no element is ever in its initial position.\n\n### Swift Types\n\n#### Integers\n\nAll of Swift's native integer types conform to the `Random-` protocols.\n\nThe `random(using:)` function creates an integer of any value. As a result,\nnegative values can result for signed integers.\n\n```swift\nInt.random(using: \u0026randomGenerator)               // An Int within Int.min and Int.max\nInt.random(in: 10...20, using: \u0026randomGenerator)  // An Int within 10 and 20\n```\n\nTo create a positive signed integer, use `random(to:using:)` or `random(through:using:)`.\n\n```swift\nInt.random(to: 1000, using: \u0026randomGenerator)     // 731\nInt.random(through: 10, using: \u0026randomGenerator)  // 4\n```\n\nSigned integers can be created from any range, without danger of overflow.\n\n```swift\nInt.random(in: (.min + 1000)...(.max - 200), using: \u0026randomGenerator)  // 5698527899712144154\n```\n\n#### Floating Point Numbers\n\nGenerate a random floating point value from within a range or `0.0...1.0` by\ndefault.\n\n```swift\nDouble.random(using: \u0026randomGenerator)                 //  0.9813615573117475\nDouble.random(in:  -10...10, using: \u0026randomGenerator)  // -4.03042337718197\nFloat.random(in:   -10...10, using: \u0026randomGenerator)  //  5.167088\nFloat80.random(in: -10...10, using: \u0026randomGenerator)  // -3.63204542399198874\n```\n\nAll `FloatingPoint` types can also conform to `RandomInClosedRange`\nout-of-the-box.\n\n#### Bool\n\n`Bool.random(using:)` has a 50/50 chance of being `true`.\n\nIf you need different probability, there's also `random(withWeight:using:)`,\nwhich has 1 in `weight` chance of being `true`.\n\n#### String, Character, and UnicodeScalar\n\n`String`, `Character`, and `UnicodeScalar` generate values within `\" \"...\"~\"` by\ndefault.\n\n```swift\nString.random(ofLength: 10, using: \u0026randomGenerator)                 // \"}+[=Ng\u003e$w1\"\nString.random(ofLength: 10, in: \"A\"...\"z\", using: \u0026randomGenerator)  // \"poUtXJIbv[\"\n\nCharacter.random(using: \u0026randomGenerator)                 // \"#\"\nCharacter.random(in: \"A\"...\"z\", using: \u0026randomGenerator)  // \"s\"\n```\n\n#### Arrays\n\nAn array of random values can be generated for types conforming to `Random` with\n`init(randomCount:using:)`.\n\nSimilar initializers exist for all other `Random-` protocols.\n\n```swift\nlet randoms = Array\u003cInt\u003e(randomCount: 100, using: \u0026randomGenerator)  // [8845477344689834233, -957454203475087100, ...]\n```\n\nFor types conforming to `UnsafeRandom`, a faster alternative is `init(unsafeRandomCount:using:)`.\nThis initializer fills the buffer directly rather than using `random(using:)`.\n\n```swift\nlet unsafeRandoms = Array\u003cInt\u003e(unsafeRandomCount: 100, using: \u0026randomGenerator)  // [759709806207883991, 4618491969012429761, ...]\n```\n\n##### Arrays Benchmark\n\nA benchmark of generating 1000 random `Int` arrays of 10000 count:\n\n| Generator                 | Time (in seconds) |\n| ------------------------- | ----------------- |\n| `Xoroshiro`               | 0.0271            |\n| `Xorshift`                | 0.0568            |\n| `XorshiftStar`            | 0.0319            |\n| `ChaCha`                  | 0.2027            |\n| `MersenneTwister`         | 0.0432            |\n| `ARC4Random`              | 0.2416            |\n| `DeviceRandom`            | 5.3348            |\n\n**Note:** Results may vary due to various factors.\n\nThis same benchmark can be run with:\n\n```shell\n./benchmark.sh --all-generators --array 10000 --count 1000\n```\n\n### Foundation Types\n\n#### Date\n\nA random `Date` can be generated between two `Date` or `TimeInterval` values.\n\nThe default `random(using:)` function returns a `Date` within `Date.distantPast` and\n`Date.distantFuture`.\n\n```swift\nDate.random(using: \u0026randomGenerator)  // \"Aug 28, 2006, 3:38 AM\"\nDate.random(in: Date.distantPast...Date(), using: \u0026randomGenerator)  // \"Feb 7, 472, 5:40 AM\"\n```\n\n#### Decimal\n\nThe `Decimal` type conforms to various `Random-` protocols.\n\nThe `random(using:)` function returns a `Decimal` between 0 and 1 by default.\n\n```swift\nDecimal.random(using: \u0026randomGenerator)                  // 0.87490000409886706715888973957833129437\nDecimal.random(in: 0.0...10.0, using: \u0026randomGenerator)  // 6.5464639772070720738747790627821299859\n```\n\n#### NSNumber\n\nA random number can be generated from within an integer or double range, or\n`0...100` by default.\n\n```swift\nNSNumber.random(using: \u0026randomGenerator)                 // 79\nNSNumber.random(in: -50...100, using: \u0026randomGenerator)  // -27\nNSNumber.random(in: 100...200, using: \u0026randomGenerator)  // 149.6156950363926\n```\n\n#### Cocoa and UIKit Types\n\n##### NSColor and UIColor\n\nA random color can be generated, with or without random alpha.\n\n```swift\nNSColor.random(using: \u0026randomGenerator)              // r 0.694 g 0.506 b 0.309 a 1.0\nNSColor.random(alpha: true, using: \u0026randomGenerator) // r 0.859 g 0.57  b 0.409 a 0.047\n\nUIColor.random(using: \u0026randomGenerator)              // r 0.488 g 0.805 b 0.679 a 1.0\nUIColor.random(alpha: true, using: \u0026randomGenerator) // r 0.444 g 0.121 b 0.602 a 0.085\n```\n\n### CoreGraphics Types\n\n#### CGFloat\n\nBecause `CGFloat` conforms to `FloatingPoint`, it conforms to\n`RandomInClosedRange` just like how `Double` and `Float` do.\n\n```swift\nCGFloat.random(using: \u0026randomGenerator)               // 0.699803650379181\nCGFloat.random(in: 0...100, using: \u0026randomGenerator)  // 43.27969591675319\n```\n\n#### CGPoint\n\nA random point can be generated from within ranges for x and y.\n\n```swift\nCGPoint.random(using: \u0026randomGenerator) // {x 70.093 y 95.721}\nCGPoint.random(xRange: 0...200, yRange: 0...10, using: \u0026randomGenerator) // {x 73.795 y 0.991}\n```\n\n#### CGSize\n\nA random size can be generated from within ranges for width and height.\n\n```swift\nCGSize.random(using: \u0026randomGenerator) // {w 3.744  h 35.932}\nCGSize.random(widthRange: 0...50, heightRange: 0...400, using: \u0026randomGenerator) // {w 38.271 h 239.636}\n```\n\n#### CGRect\n\nA random rectangle can be generated from within ranges for x, y, width, and\nheight.\n\n```swift\nCGRect.random(using: \u0026randomGenerator)  // {x 3.872  y 46.15  w 8.852  h 20.201}\nCGRect.random(xRange: 0...50,\n              yRange: 0...100,\n              widthRange: 0...25,\n              heightRange: 0...10,\n              using: \u0026randomGenerator)  // {x 13.212 y 79.147 w 20.656 h 5.663}\n```\n\n#### CGVector\n\nA random vector can be generated from within ranges for dx and dy.\n\n```swift\nCGVector.random(using: \u0026randomGenerator) // {dx 13.992 dy 89.376}\nCGVector.random(dxRange: 0...50, dyRange: 0...10, using: \u0026randomGenerator) // {dx 35.224 dy 13.463}\n```\n\n## Extra\n\n### [BigInt](https://github.com/lorentey/BigInt)\n\nRandomKit extensions for Károly's [BigInt](https://github.com/lorentey/BigInt) library are available in [RandomKitBigInt](https://github.com/nvzqz/RandomKitBigInt).\n\n## License\n\nRandomKit and its assets are released under the [MIT License](LICENSE.md). Assets\ncan be found in the [`assets`](https://github.com/nvzqz/RandomKit/tree/assets)\nbranch.\n\nParts of this project utilize code written by [Matt Gallagher](https://github.com/mattgallagher) and, in conjunction\nwith the MIT License, are licensed with that found [here](https://www.cocoawithlove.com/about/).\n","funding_links":["https://www.patreon.com/nvzqz","https://www.paypal.me/nvzqz"],"categories":["Utility","Libs","Swift","The Index"],"sub_categories":["Web View","Utility","System Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvzqz%2FRandomKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvzqz%2FRandomKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvzqz%2FRandomKit/lists"}