Pigmo.com Litepaper
  • 🐷Introduction to Pigmo & $PIG
  • PIGMO TOKEN - $PIG
    • 🪙Tokenomics
      • NFT Holders (30%)
      • Airdrop to strategic Crypto communities (7.5%)
      • Mini app farm (7.5%)
      • Treasury and Governance (10%)
      • Liquidity and Development (15%)
      • Team and Advisors (5%)
      • Capital raise (15%)
      • Partnerships and Marketing (10%)
    • 🔨Utility
      • 🎰Exclusive Benefits
      • 💰Stake to earn
      • 🔥Buy back & burn
      • 🔓Locked Staking
      • 📅The future
  • 🔗EXTERNAL LINKS
    • Discord
    • Telegram
    • Twitter
    • Pigmo app
    • Official telegram mini app
    • $PIG farm mini app
  • CASINO
    • 🛣️Roadmap
    • 👑VIP System & benefits
    • 📞Contact us
  • Fairness
    • 🎰Outsourced providers
    • ⚖️Provable Fairness
    • 🛡️Implementation
    • 🔄Conversions
    • 🎲Game events
  • Transactions within the app
    • 💰Supported tokens
    • 📃Withdraw requirements
    • 🕒Pending withdrawals timeframe
    • ⛽Blockchain gas fees
    • 💬Support
  • Affiliate & partnership
    • 🚀Listing your token
    • 📊Effective RTP
    • 🤝Affiliate program
Powered by GitBook
On this page
  • Floats to Bytes
  • From Floats to In-Game Actions
  • Rearrangement of Gaming Sequences
  1. Fairness

Conversions

Floats to Bytes

The hexadecimal 32-byte hash serves as the foundation for the Random Number Generator function (byteGenerator). Utilizing the implementation guidelines detailed in the cursor section, we harness sets of 4 bytes from this hash to produce individual game outcomes. These 4-byte segments undergo transformation into floats spanning the range of 0 to 1. Employing 4 bytes instead of one ensures enhanced precision during float generation. Subsequently, these floats constitute the core output of our provably fair algorithm, eventually manifesting into tangible game events.

// Convert the hash output from the rng byteGenerator to floats
function generateFloats ({ serverSeed, clientSeed, nonce, cursor, count }) {

    // Random number generator function
    const rng = byteGenerator({ serverSeed, clientSeed, nonce, cursor });

    // Declare bytes as empty array
    const bytes = [];

    // Populate bytes array with sets of 4 from RNG output
    while (bytes.length < count * 4) {
        bytes.push(rng.next().value);
    }

    // Return bytes as floats using lodash reduce function
    return _.chunk(bytes, 4).map(bytesChunk =>
        bytesChunk.reduce((result, value, i) => {
            const divider = 256 ** (i + 1);
            const partialResult = value / divider;
            return result + partialResult;
        }, 0)
    );
};

From Floats to In-Game Actions

While the process of generating random outputs remains consistent across all our gaming experiences, a distinctive approach emerges when converting these floats into in-game actions.

The initial step in this conversion involves multiplying the randomly generated float by the total number of potential outcomes specific to the game at hand. For instance, in a game utilizing a 52-card deck, this calculation simply involves multiplying the float by 52. The resultant value is then mapped to a corresponding in-game action. For games necessitating multiple actions, this procedure persists, iterating through each consecutive set of 4 bytes within the generated result chain, as produced by the aforementioned byteGenerator function.

Rearrangement of Gaming Sequences

Consider video poker as an illustration: initially, there are 52 cards in the deck. Consequently, the first game event is determined by multiplying the float by 52. Subsequently, with each card dealt, the available card pool diminishes by one, influencing subsequent translations. This iterative process continues until all requisite game events are generated.

In the context of Mines and Keno, the procedure mirrors that of video poker, albeit with adjustments to accommodate tiles or grid locations instead of cards. The goal remains consistent: to ensure that each generated game event is unique within the sequence of results, preventing duplication.

PreviousImplementationNextGame events

Last updated 1 year ago

The process for reshuffling game outcomes in titles like Keno, Mines, and Video Poker involves the application of the . This algorithm significantly impacts the translation of floats into game events, as it progressively reduces the pool of potential game event options with each translation step.

🔄
Fisher-Yates shuffle algorithm