title
Code:
function calculateResult(gameId, serverSeed, publicSeed) {
const combinedSeed = gameId + serverSeed;
const hash = crypto.createHash('sha256').update(combinedSeed).digest('hex');
const result = parseInt(hash.slice(0, 16), 16); // Use the first 16 characters of the hash
const normalizedResult = (result % 2) + 1; // Normalize result to 1 or 2
console.log(normalizedResult);
return normalizedResult;
}```