Post
Topic
Board Gambling
Re: New btc roulette - Sport, Dice, Casino - BetKing.io
by
BetKing.io
on 02/07/2018, 15:01:52 UTC
How exactly does the provably fair work on roulette?

Oh, noticed we don't have the provably fair page updated on site to show this.

The algorithm used is as follows:
Each spin has a unique client and server seed. you can edit your client seed.

Code:

const shuffle = function (deck, mt) {
  let i = deck.length;
  let j;
  let temp;

  while (--i >= 0) {
    j = Math.floor(mt.int() % (i + 1));
    temp = deck[j];
    deck[j] = deck[i];
    deck[i] = temp;
  }
  return deck;
};

const calculateRouletteSpin = function (serverSeed, clientSeed) {
  const hash = crypto.createHash('sha256')
    .update(serverSeed + clientSeed)
    .digest('hex')
    .toString();

  const seed = parseInt(hash.substring(hash.length - 8), 16);
  const mt = new MersenneTwister(seed);
  const newDeck = shuffle(deck, mt);
  const winner = newDeck[36];

  return winner.toString();
};