0.1.0 • Published 7 years ago

@provably-fair/shuffle v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

@provably-fair/shuffle

Array shuffling functionality for provably fair games.

Version (npm)

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 of secretSeed shall be known before revealing publicSeed.
  • 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.