Comprovadamente Justo
Insira os detalhes do jogo para verificar seus resultados
Código
Escolha um jogo acima para inspecionar o código-fonte que produz seus resultados.
import { createHmac } from 'crypto';
import Decimal from 'decimal.js';
const UINT32_MAX = 0x100000000; // 2^32
/**
* Generates an infinite deterministic stream of cryptographically secure
* 32-bit unsigned integers derived from HMAC-SHA256.
*
* @param key - Secret cryptographic key (server seed). Must remain private until revealed.
* @param message - Public input string (e.g., client seed, nonce, or domain label).
*
* @remarks
* - Uses HMAC-SHA256 as a pseudorandom function (PRF) to produce a reproducible
* and verifiable sequence of numbers.
* - `step` ensures each 32-bit block is derived from a unique input.
* - Output is split into 32-bit chunks, suitable for unbiased integer or bit-level
* extraction.
* - Bits are consumed starting from the Most Significant Bit (MSB) to preserve
* full numeric precision and maximum entropy.
* - Fully deterministic: anyone with the same key and message can verify the results.
*/
function* getUint32Stream(key: string, message: string): Iterator<number> {
let step = 0;
while (true) {
const hmac = createHmac('sha256', key);
hmac.update(`${message}:${step}`);
const hash = hmac.digest(); // 32 bytes (256 bits)
for (let i = 0; i < hash.length; i += 4) {
yield (
(hash[i] << 24) |
(hash[i + 1] << 16) |
(hash[i + 2] << 8) |
hash[i + 3]
) >>> 0; // force unsigned 32-bit
}
step++;
}
}
function determineResult(options: {
serverSeed: string;
clientSeed: string;
nonce: number;
/**
* Constraints:
* - Must contain minimum 1.01 and 2 digit numbers
*/
targetMultiplier: string;
}) {
const stream = getUint32Stream(
options.serverSeed,
`${options.clientSeed}:${options.nonce}:limbo`
);
const value = stream.next().value;
// fairValue ∈ [1, 2^32]
const fairValue = new Decimal(value).plus(1);
const uint32Max = new Decimal(UINT32_MAX);
const houseEdge = new Decimal(0.99);
const rawMultiplier = uint32Max.div(fairValue).mul(houseEdge);
const generatedMultiplier = Decimal.max(rawMultiplier, new Decimal(1));
const finalMultiplier = generatedMultiplier.toDecimalPlaces(
2,
Decimal.ROUND_FLOOR
);
const target = new Decimal(options.targetMultiplier);
const win = finalMultiplier.greaterThanOrEqualTo(target);
return {
generatedMultiplier: finalMultiplier.toString(),
win,
multiplier: win
? options.targetMultiplier
: '0',
};
}
console.log(
determineResult({
clientSeed: 'limbo-test',
serverSeed: 'limbo-test',
nonce: 0,
targetMultiplier: '2.0'
})
)
