1/** 2 * Casino randomness â hooks for future house / username skew. 3 * v1: fair (50/50) outcomes. 4 */ 5(function (global) { 6 'use strict'; 7 8 function hashUsername(username) { 9 if (!username) return 0; 10 var h = 0; 11 for (var i = 0; i < username.length; i++) { 12 h = ((h << 5) - h) + username.charCodeAt(i); 13 h |= 0; 14 } 15 return Math.abs(h); 16 } 17 18 /** 19 * @param {string} gameId 20 * @param {string|null} username 21 * @returns {number} 0..1 22 */ 23 function roll(gameId, username) { 24 // Future: bias using gameId + username hash + house edge config. 25 void gameId; 26 void username; 27 void hashUsername; 28 return Math.random(); 29 } 30 31 /** @returns {boolean} */ 32 function flipIsHeads(username) { 33 return roll('coinflip', username) < 0.5; 34 } 35 36 /** @returns {boolean} player wins odd/even bet */ 37 function diceOddWins(username) { 38 return roll('dice', username) < 0.5; 39 } 40 41 /** @returns {boolean} slots pays out */ 42 function slotsWins(username) { 43 return roll('slots', username) < 0.5; 44 } 45 46 global.CasinoLuck = { 47 roll: roll, 48 flipIsHeads: flipIsHeads, 49 diceOddWins: diceOddWins, 50 slotsWins: slotsWins 51 }; 52})(typeof window !== 'undefined' ? window : this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.