Rouletteにおけるプロバブリーフェアの仕組み
CloudbetでのRouletteの遊び方と、各スピンがプロバブリーフェアであることを確認する方法をご紹介します。
Rouletteの遊び方
Rouletteは、番号が振られたホイールの上でボールがどこに着地するかにベットする、定番のカジノゲームです。番号テーブル上で1つ以上のベットを行うと、ホイールが回転し、ボールが投入されます。ボールが番号付きのポケットに収まると、それが当選番号となり、その番号をカバーしていたベットに配当が支払われ、それ以外はすべて負けとなります。
ベットの方法
結果へのベットにはいくつかの方法があり、同じラウンドで複数のベットを自由に組み合わせることができます。インサイドベット(特定の番号へのベット)は配当が高い分当てるのが難しく、アウトサイドベット(より広いグループへのベット)は配当が低い分当たりやすくなります。
- ストレートアップ/シングルナンバー(35:1): 1つの番号(0~36、アメリカンルーレットでは00も含む)へのベット。
- スプリット(17:1): 隣接する2つの番号。
- ストリート(11:1): 横一列に並ぶ3つの番号。
- コーナー(8:1): 1つの角で接する4つの番号。
- ファーストフォー/トップライン(ヨーロピアンは8:1、アメリカンは6:1): 0(アメリカンでは00も)、1、2、3をカバー。
- シックスライン(5:1): 隣接する2列、6つの番号。
- コラム(2:1): 縦3列のうちの1つ。
- ダズン(2:1): 1~12、13~24、25~36のいずれか。
- 赤/黒、奇数/偶数、ハイ/ロー(いずれも1:1)。
ヨーロピアンルーレットとアメリカンルーレット
Cloudbetでは両方のバージョンを提供しています。ヨーロピアンルーレットはゼロが1つだけ(37通りの結果、RTP 97.30%)、アメリカンルーレットは「00」のポケットが追加されます(38通りの結果、RTP 97%)。これによりハウスエッジがわずかに高くなります。どちらのバージョンをプレイしているかは、ベットを行う前に明確に表示されます。どちらのバージョンにも、あらかじめ設定したチップ額とスピン回数で連続して回せるオートプレイモードが含まれています。
ベットが確定してラウンドの結果が決まると、当選したベットは自動的にそのオッズに従って配当が支払われ、テーブルは次のラウンドに向けてリセットされます。
このページでは、Rouletteがプロバブリーフェアな乱数列をどのように当選番号に変換するかを解説します。その乱数列がそもそもどのように生成されるか——サーバーシード、クライアントシード、ノンス、ハッシュ化、SHAKE256——については、Cloudbetのプロバブリーフェア解説をご覧ください。
乱数からRouletteの結果への変換
Rouletteでは、プロバブリーフェアの仕組みによって、当選番号が後付けで選ばれたものではなく、検証可能なランダム性によって選ばれたことを証明する必要があります。
手順はシンプルです。ヨーロピアンルーレットでは、乱数列から0から36までの整数を1つサンプリングし、それが当選番号になります。アメリカンルーレットでは、サンプリングされる数値は0から37までの範囲となり、「37」はダブルゼロ「00」に対応付けられます。0から36の結果はそのまま使われます。
当選番号の選定方法
SHAKE256によって生成された乱数バイト列(プロバブリーフェアのページをご覧ください)は、0から2³²−1の範囲の4バイト符号なし整数に分割されます。Rouletteの当選番号は37通り(ヨーロピアン)または38通り(アメリカン)の結果から選ばれるため、以下の手順ではPは37または38になります。
これらP通りの結果から公正に当選番号を選ぶため、リジェクションサンプリングを適用し(プロバブリーフェアの仕組みをご覧ください)、その結果をPで割った余りを取ります——その余りが当選番号となります(アメリカンルーレットの場合、「37」は「00」として表示されます)。

生成された当選番号は、サーバー側で保存・非公開化されます——ラウンドが始まった後は、気づかれずに変更・改ざんすることはできません。ベットを確定すると、この事前に決定された番号と照合されてラウンドの結果が確定します。
ご自身のRouletteの結果を検証する
Cloudbetの実際のRoulette実装(ヨーロピアン・アメリカン両方)に忠実な、簡単なNode.jsプログラムを用意しました。サーバーシード、クライアントシード、ノンスを入力してご自身の結果を再現してください。(補足: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.
const Version = Object.freeze({ AMERICAN: "american", EUROPEAN: "european" }); // Here the possible versions are listed
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
let myRouletteVersion = Version.AMERICAN; // ✍️YOUR_INPUT✍️: Enter your roulette version (either Version.AMERICAN or Version.EUROPEAN)
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 getGameResult(rouletteVersion, rng) {
let numOfOutcomes = 0;
if (rouletteVersion === Version.EUROPEAN) {
numOfOutcomes = 37;
} else if (rouletteVersion === Version.AMERICAN) {
numOfOutcomes = 38;
}
let result = String(sample(numOfOutcomes, rng))
// Convert the result '37' to '00'
if (result === '37') {
result = '00';
}
return result;
}
// Sample a number from P number of outcomes using Rejection Sampling
function sample(P, rng) {
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;
}
// Example usage
(function main() {
let nonce = 1;
let rouletteVersion = Version.AMERICAN;
if (usingCustomData) { nonce = myNonce; rouletteVersion = myRouletteVersion; }
const { serverSeed, commitment } = generateServerSeed();
const clientSeed = getClientSeed();
const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
const numbersToGenerate = 1 * 2; // We need 1 random number, but there is an improbable case we'll need two
const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);
const value = getGameResult(rouletteVersion, 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(`🎯 Winning Number (in the ${rouletteVersion} version):`, value);
})();

