0.1.0 • Published 9 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.hmacAlgorithmstring 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 ofsecretSeedshall be known before revealingpublicSeed.hmacBufferUIntParserfunction? Function to be used for parsing a UInt from the generated HMAC buffer.fallbackProviderfunction? 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
9 years ago