-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to serve tasks in random order (#27)
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
declare module 'reservoir' { | ||
|
||
interface ReservoirArray<T> extends Array<T> { | ||
/** | ||
* datum: one or more elements to consider for inclusion into the reservoir. | ||
* Returns the current length of the reservoir. | ||
*/ | ||
pushSome(...datum: T[]): number; | ||
} | ||
|
||
/** | ||
* Create a new reservoir sampler. | ||
* | ||
* @param reservoirSize is the maximum size of the reservoir. This is the number of elements | ||
* to be randomly chosen from the input provided to it using pushSome. Default is 1. | ||
* @param randomNumberGenerator is an optional random number generating function to use in | ||
* place of the default Math.random. | ||
*/ | ||
function Reservoir<T>( | ||
reservoirSize?: number, | ||
randomNumberGenerator?: () => number | ||
): ReservoirArray<T>; | ||
|
||
export = Reservoir; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -560,6 +560,10 @@ [email protected]: | |
iconv-lite "0.4.19" | ||
unpipe "1.0.0" | ||
|
||
reservoir@^0.1.2: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/reservoir/-/reservoir-0.1.2.tgz#f08eac156495123039cbc5ee06f3f58979e45605" | ||
|
||
rimraf@~2.2.6: | ||
version "2.2.8" | ||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" | ||
|