References
api
summary | ||
public |
Returns a double in the interval [0, 1) using JavaScript Math.random(). |
|
public |
Sample a single element from an array. |
|
public |
Returns a double in interval [i, j[ (i included, j excluded) according to a uniform distribution. |
|
public |
Returns an integer in interval [i, j[ (i included, j excluded) according to a uniform distribution. |
|
public |
Pick an element from range(start, stop, step) uniformly at random. |
|
public |
Reservoir sampling. |
|
public |
Take a sample of size n (without replacement) from the items i through j-1 of the input array. |
|
public |
Shuffle array in-place between positions i and j-1 (inclusive). |
|
public |
Given an input iterable, constructs an array containing the elements of the input shuffled uniformly at random. |
kernel
summary | ||
private |
Builds a choice function given a randint function. |
|
private |
F _fisheryates(randint: Function): Function Sample elements from an array using Fisher-Yates method. |
|
private |
F _fisheryates_inside_out(randint: Function): Function Shuffle elements of an iterable using an inside-out implementation of the Fisher-Yates method. |
|
private |
F _randfloat(random: Function): Function Builds a randfloat function given a random number generator. |
|
private |
Builds a randint function given a random number generator. |
|
private |
F _randrange(randint: Function): Function Builds a randrange function given a randint function. |
|
private |
Shuffle the array by sampling the entire array. |
|
private |
Construct a sampling function using Algorithm R due to Alan Waterman (both name and attribution are due to Knuth). |