Diceにおけるプロバブリーフェアの仕組み
CloudbetでのDiceの遊び方と、各出目がプロバブリーフェアであることを確認する方法をご紹介します。
Diceの遊び方
Diceはスピーディなゲームで、ランダムに生成される数値が、ご自身で選んだ目標値より上か下かにベットします。目標値を選び、結果がその目標値を上回る(Roll Over)か下回る(Roll Under)かにベットします。目標値をレンジの端に近づけるほど当たる確率は下がりますが、当たったときの配当は大きくなります。ベットを確定すると、結果は即座に表示されます。
Cloudbet Originals Dice
CloudbetオリジナルのDiceは、0.00から100.00までの目標レンジ、99%のRTP、最大x9,800の倍率を備え、$0.01から$10,000までのベットに対応しています。Auto Bet機能を使えば、複数ラウンドを自動化できます。
このページでは、Diceが検証済みの乱数をどのように出目へと変換するかを解説します。ランダム性そのものがどのように生成・保護されているか——サーバーシード、クライアントシード、ノンス、ハッシュ化——については、プロバブリーフェアのページをご覧ください。Dice: Golden Ticketをプレイされる方へ:Golden Ticketもここで説明するのと同じ方法でダイスの値をサンプリングした上で、Golden Ticketの値と倍率を追加しています。
乱数からDiceの結果への変換
Diceの結果は、ほかのすべてのCloudbet Originalsと同じ検証可能なランダム性に、証明可能な形で結びついている必要があります。ラウンドの乱数列が生成されると(SHAKE256による生成方法についてはプロバブリーフェアのプロセスをご覧ください)、Diceでは次のように利用されます。
0から10,000(両端を含む)の整数を乱数列からサンプリングし、それを100で割ります——これにより小数点以下2桁を持つ0から100の値が得られます。これがDiceの結果です。
サンプリングの仕組み
Diceには10,001通りの結果があり得るため(0.00から100.00まで0.01刻み)、このゲームではP = 10,001です。
これら10,001通りの結果から公正に1つを選ぶため、Diceはプロバブリーフェアのガイドで説明されているのと同じリジェクションサンプリングの手法を使います——32ビットの乱数を生成し、それが結果に偏りをもたらす場合は棄却して再サンプリングし、公正な数値が得られるまで繰り返します。その数値は10,001で割った余り(モジュロ演算)を取ることで0から10,000の値になり、それを100で割って最終結果とします。

ゲームプレイ
結果はベットする前にサーバー側で生成・確定されます——ラウンドが始まった後は、気づかれずに変更したり改ざんしたりすることはできません。ベット後、選択した目標値がこの事前生成済みの数値と比較され、予測が正しかったかどうかが判定されます。
Diceのプロバブリーフェアを独自に検証するためのコード
このプログラムはCloudbetのDice実装に忠実なものです。サーバーシード、クライアントシード、ノンスを入力してご自身の結果を検証してください。注:Cloudbetでゲームのサーバーシードを公開するには、まず新しいサーバーシードにローテーションする必要があります。
依存関係:
npm install js-sha3
コード:
// If you are running this yourself, then you can input your own data here
// You can then compare:
// 1) Cloudbet's provided Commitment to the Commitment outputted here. This proves that the Server Seed was not altered during gameplay.
// 2) Cloudbet's provided game outcome to the game outcome outputted here. This proves that your game's outcome was determined solely by the pre-game seeds and was not altered afterwards.
let myServerSeed = 'your_server_seed'; // ✍️YOUR_INPUT✍️: Enter your (unhashed) Server Seed here
let myClientSeed = 'your_client_seed'; // ✍️YOUR_INPUT✍️: Enter your Client Seed here
let myNonce = 1; // ✍️YOUR_INPUT✍️: Enter your Nonce here
const usingCustomData = false; // Change this to true if you are using your own data
// Load libraries
const crypto = require('crypto');
const { sha3_256, shake256 } = require('js-sha3');
// Step 1: Generate a Server Seed and Commitment
// And generate a Client Seed - either by player input or by the player's browser
function generateServerSeed() {
let seed = crypto.randomBytes(32).toString('hex');
if (usingCustomData) { seed = myServerSeed; }
const commitment = sha3_256(seed);
return { 'serverSeed': seed, 'commitment': commitment };
}
function getClientSeed() {
let seed = crypto.randomBytes(32).toString('hex');
if (usingCustomData) { seed = myClientSeed; }
return seed;
}
// Step 2: Create a Round Signature with SHA3 using a Server Seed, Client Seed and Nonce
function createRoundSignature(serverSeed, clientSeed, nonce) {
return sha3_256(`${serverSeed}:${clientSeed}:${nonce}`);
}
// Step 3: Create a SHAKE256 stream generator from a Round Signature.
// To simplify this example program, this function doesn't create a stream, but instead a sequence of custom length.
function* createRandomNumberSequence(numbersToGenerate, roundSignature) {
const numOfBytes = 4 * numbersToGenerate; // 4 bytes (32 bits) per random number we generate
const byteStream = shake256.create(8 * numOfBytes); // shake takes bits as input
byteStream.update(roundSignature); // Use the Round Signature to seed the generator
const buf = Buffer.from(byteStream.digest()); // The Buffer class lets us package every 4 bytes into one 32-bit integer
for (let i = 0; i < numbersToGenerate; i++) {
yield buf.readUInt32BE(i * 4); // Read buf in 4-byte steps
}
throw new Error("No more numbers in the random number sequence! Fix: make 'numbersToGenerate' larger.");
}
// Step 4: Draw from the random number sequence to calculate the game result
function getDiceResult(rng) {
const diceMinValue = 0;
const diceMaxValue = 10000;
let number = sampleFromRange(diceMinValue, diceMaxValue, rng);
number = number / 100; // So that the dice's value ranges from 0 to 100
return number;
}
// Sample a number between 'min' to 'max' (inclusive) using Rejection Sampling
function sampleFromRange(min, max, rng) {
const P = max - min + 1
const maxAcceptable = Math.floor(0x100000000 / P) * P;
// Rejection sampling
let rand;
do {
rand = rng.next().value;
} while (rand >= maxAcceptable);
// Modulo operation
const sampled_number = rand % P;
return sampled_number + min;
}
// Example usage
(function main() {
let nonce = 1;
if (usingCustomData) { nonce = myNonce; }
const { serverSeed, commitment } = generateServerSeed();
const clientSeed = getClientSeed();
const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
const numbersToGenerate = 1 * 2; // We need 1 random number, however due to rejection sampling we may need more
const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);
const diceValue = getDiceResult(rng);
console.log('📝 Commitment (shown before the game):', commitment);
console.log('🔒 Server Seed (revealed after the game):', serverSeed);
console.log('🎲 Client Seed:', clientSeed);
console.log('🔢 Nonce:', nonce);
console.log('🔁 Round Signature (can be verified after the game):', roundSignature);
console.log('🎯 Dice landed on:', diceValue);
})();


