Author

Topic: Math behind crash game multiplier generation (Read 187 times)

newbie
Activity: 8
Merit: 0
August 14, 2019, 01:12:29 PM
#1
Code:

exports.crashPointFromHash = function(serverSeed) { // TODO: check the probablity of instant crash everywhere
    var hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');
 
    // In 1 of 101 games the game crashes instantly.
    if (divisible(hash, 101))
        return 0;
 
    // Use the most significant 52-bit from the hash to calculate the crash point
    var h = parseInt(hash.slice(0,52/4),16);
    var e = Math.pow(2,52);
 
    return Math.floor((100 * e - h) / (e - h));
};

Ignore all the hash related code, all it does is generate h such that h is uniform in [ 0 , 2^52 - 1]
e is 2^52


How would I find the expected value from this algorithm?
What is the probability density function?
How would I change the house edge?
Is it only " if (divisible(hash, 101)) return 0;" that gives the house an advantage?

Initially I thought it would be exponentially distributed but it's not

When doing simulations it seems that the edge is around 2% but even when removing the divisible by 101 code, the edge is around 1% and I don't understand where it comes from

Can somebody provide a deeper math insight in this? How did they come up with this way of generating crash points?
Jump to: