Latest 1.0.0
Homepage https://github.com/SebastianOsinski/SORandom
License MIT
Platforms ios 8.0, osx 10.9, watchos 2.0, tvos 9.0

Version
License
Platform

SORandom is collection of pseudorandom generators from various statistical distributions and functions for pseudorandom array sampling.

Installation

SORandom is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SORandom"

Author

Sebastian OsiƄski, [email protected]

License

SORandom is available under the MIT license. See the LICENSE file for more info.

Available psuedorandom generators:

Sampling functions:

  • Sampling with replacement
  • Sampling without replacement
  • Sampling with replacement with given weights

How to use it?

import SORandom

//Single pseudorandom normal variable
//with mean 0 and standard deviation 1
let x = randNormal(0, 1)

//Array of pseudorandom independent normal variables
//with mean 0 and standard deviation 1 and length 10
let sample = randNormals(0, 1, 10)

//Sampling from array:

//with replacement
let numbers = [10, 11, 45, 1, 0, 4]
let bootstrapSample = sampleWithReplacement(numbers, 10)

//without replacement
let names = ["John", "Bob", "Anna", "Alice", "Chris", "Luke"]
let usersOrder = sampleWithoutReplacement(names, 4)

//with given weights
let letters = ["a", "b", "c", "d", "e"]
let probabilities = [0.5, 0.05, 0.05, 0.1, 0.3]

let randomLetters = sampleWithWeights(letters, probabilities, 10)

Latest podspec

{
    "name": "SORandom",
    "version": "1.0.0",
    "summary": "Collection of functions for generating psuedorandom variables from various distributions",
    "homepage": "https://github.com/SebastianOsinski/SORandom",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Sebastian Osiu0144ski",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/SebastianOsinski/SORandom.git",
        "tag": "1.0.0"
    },
    "source_files": "SORandom/**/*.swift"
}

Pin It on Pinterest

Share This