0.1.0 • Published 7 years ago
@provably-fair/shuffle v0.1.0
@provably-fair/shuffle
Array shuffling functionality for provably fair games.
API Reference
shuffle
Shuffles an array based on the given seeds, using the given HMAC algorithm.
Parameters
arr
[] Array to be shuffled.hmacAlgorithm
string Algorithm used for computing the HMAC of the given seed pair.secretSeed
(string | Buffer) Secret seed used as HMAC key.publicSeed
(string | Buffer)? Public seed used as HMAC data. To prove fairness of random outputs, the hash ofsecretSeed
shall be known before revealingpublicSeed
.hmacBufferUIntParser
function? Function to be used for parsing a UInt from the generated HMAC buffer.fallbackProvider
function? Function to provide a fallback value in a given range whether no appropriate number can be parsed from the generated HMAC buffer.
Returns [] A new array instance containing every element of the input.
0.1.0
7 years ago