@provably-fair/primedice
v0.2.0
Published
Primedice bet simulation and verification tools
Downloads
8
Readme
@provably-fair/primedice
Primedice bet simulation and verification tools.
API Reference
generateServerSeed
Generates a random server seed.
Parameters
size
number? Size of random buffer in bytes. (optional, default16
)
Returns string A server seed of the given size.
parseUIntFromBuffer
Parses a buffer and tries returning the first unsigned integer which fits the given range.
Parameters
buf
Buffer Buffer to be parsed.max
number Maximum value of output (excluded).size
number Size of parsable chunks in bytes. Must be less than or equal to 6.startOffset
number? Where to start reading the buffer. (optional, default0
)
Returns number An unsigned integer parsed from the given buffer. If no appropriate number can
be parsed, NaN
is returned.
roll
Generates a random roll number based on the given seeds.
Parameters
serverSeed
string Server seed used as HMAC key.clientSeed
string Client seed used as HMAC data. To prove fairness of random outputs, the hash ofserverSeed
shall be known before revealingclientSeed
.nonce
number Number of bets made with the given seed pair (excluding current roll).
Returns number A number within the range [0.00, 99.99].