sor

SORandom

Collection of functions for generating psuedorandom variables from various distributions

Showing:

Popularity

Downloads/wk

0

GitHub Stars

54

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

#SORandom

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, seb.osinski@gmail.com

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)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100