Where Does This - Dynamic - House Edge Come From in Crash (Betting) - R - Learnmath
Where Does This - Dynamic - House Edge Come From in Crash (Betting) - R - Learnmath
: r/learnmath
Where does this "dynamic" house edge come from in Crash (betting)?
First of all, I'm not condoning gambling. I have been looking at online gambling sites and have been interested in
their open-source code to show house edges, but there's some results I struggle to understand. I'll show all of my
math so it'll be a bit lengthy.
The whole breakdown is in my reddit post here, but I'll recap in this post as well. Basically you put in money and it
gets multiplied more and more until the game stops or "crashes", and if you don't cash out before this moment you
lose all your money. Sometimes the game can insta-crash, and this frequency of insta-crashes is considered the
house edge.
This is provably fair because of using SHA-256 hash functions. I won't go too much into detail about this as it's
unnecessary, but just know it's producing a 64-length hexadecimal hash that we assume is random. The code is
open source and the website calculates their multipliers for when the game crashes as shown:
https://imgur.com/4BVIAkI
In the comments of my reddit post, someone points out that after a billion trials, the house edge increases as the
multiplier you wager on increases (~5% house edge for 1.01x, ~6% house edge for 1000x), but I fail to see why
that is. After a bunch of that user's vague answers and smiley faces, I'm reaching out to this subreddit.
The divisible function converts the hexadecimal hash into decimal, then modulates it by 20. This function is then
used to determine insta-crashes by seeing if the hash is divisible by 20, so you can expect to insta-crash about
1/20th of the time by this method. I understand there can be modulus bias, but as I understand it, this will only
increase the frequency of small remainders, meaning we will generally see a little over 1/20th of all hashes insta-
crashing (since divisibility checks for the remainder to be 0). I don't see how changing your betting multiplier will
affect this, as the range of hashes is fixed.
Next comes the inside of the Math.floor code. I'll simply copy and paste my results from my comment:
The code takes the first 13 hexa-digits (I guess they're called?) of the hash and converts it to decimal, then puts it
into the Math.floor equation, which can take on values 0 to 2^(52)-1, pseudo-randomly. The equation creates a
multiplier where the game will crash, and anything strictly less than 101 (note that these values are later divided by
100, where 1.00x is the insta-crash multiplier) is considered an insta-crash, which occurs 1/100th of the time:
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 1/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
0 <= h < 2^52/100 <-- Since range of h is [0,2^52), this is 1/100th of the range
Skip to main content
Log In
The rest of the multipliers are uniformly determined. Using the simplified version of the formula, I understand this
to be an inverse uniform distribution with a cdf evaluated to 1-1/m for some multiplier m > 1 (I found this definition
on Wikipedia). Because of this uniformity, I do not see where the house edge may increase for higher multipliers.
While it may not be relevant, I have also calculated expected value for continuous $1 bets for any multiplier m and
the result is a fixed -1/20:
The divisibility function and this floor function are all the calculations in the code. If my math for these two
scenarios are correct, I don't understand this "dynamic" house edge for increasing multipliers. I've suggested that
repeated hashing of SHA-256 might cause statistical bias with the hashes, but I have very little knowledge in this
subject, and I'd like to believe this hashing process is sufficiently random.
If anyone knows where my math is wrong it'd be greatly appreciated. Also, if anyone understands cryptographic
hashing, it would be cool to understand a breakdown of how truly random this hashing process is. I don't pretend
to be great with statistics or cryptography or whatever else I've used in this post, so please let me where I've went
wrong.
4 6 Share
SASSoftware_Official • Promoted
Add a comment
yes_its_him • 3y ago •
The guy that told you about the house edge told you where to look. Try to focus there.
1 Reply
AndrewBarth OP • 3y ago •
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 2/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
1 Reply
yes_its_him • 3y ago •
My observation was just that you are looking for something specific, and have advice from someone
who seems familiar with the issue, even if less than forthcoming.
Focusing on the suggested area in more detail is probably the best way forward at this point, vs. e.g.
looking at hash functions or other possibilities.
1 Reply
AndrewBarth OP • 3y ago •
Forgive me if I sound annoyed, but your comment makes it out as if I've been given advice and
stubbornly refused to believe the answer resides there. Yes my comment briefly mentions a
possible hash bias, but then goes into the comparison of v2 code with the v1 code as user
RHavar recommends.
Bear in mind that the v2 code is only 27 lines long, with 12 lines being comments or blank. 4 lines
are relevant to the hashing functionality of SHA-256, and 6 lines are related to the math involved.
The rest is variable declaration. The v1 code isn't much longer. In other words, there's not much
to compare to begin with. The code that I can compare I did so with a good amount of
computation and analysis. The entire post his comment resides in also picks apart the code piece
by piece.
The key differences are the equations, which I show in my comment and this post you're
commenting on are actually analogous to each other, and the divisible function, which I deduce
has no bias relating to changing what multiplier you wager.
With the library the v2 code uses, it's taking hours to simulate a billion samples, but by doing a
million I've found the exact same dynamic pattern within the v2 code, which RHavar claims is a
static house edge (experimental value becomes -0.0099 for 1.01x, -0.012 for 2.00x, and -0.026
for 1000x). So now I it seems the bias resides in both codes, so I should actually compare the
similarities and not the differences. I don't believe it to be the equation, as it looks to be a
standard inverse uniform distribution.
It's not that I haven't looked at the suggested area, it's that I've exhausted every angle of that
area that telling me to keep doing so is telling me to keep beating a dead horse. If I'm wrong
somewhere, by all means tell me, that's what I've been constantly asking. If I'm not, there's some
other part that's causing the bias, and that's where I assert that the only other angle I can think of
is the hash functions not accurately simulating pure randomness.
1 Reply
1 more reply
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 3/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
RobertFuego • 3y ago •
Skip to main content
Log Inhave time
If you don't get any other responses, know that I am interested in this question, but do not currently
to look into it thoroughly. If this changes in the near future I will provide what response I can.
1 Reply
What was the biggest multiplier you ever cashed out at in a crypto crash game?
1 upvote · 15 comments
Crash
5 upvotes · 22 comments
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 4/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
my game crashes when launching whenever the line "[21:17:51] [Render thread/INFO]: Hash changed to
Skip to main content
B3239954E29CDC280BAF871F5F22905D" comes up in the log Log In
1 upvote · 3 comments
Does house have a bigger advantage on "Infinite Blackjack" mode like on Roobet?
12 upvotes · 12 comments
Can anyone ever win gambling games like crash in the long run?
1 upvote · 2 comments
Possibly my worst crash ever. Just put a 200 cap bet on a number in roulette and won!!
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 5/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
Game with
Skip to least
main House Edge
content
Log In
1 upvote · 2 comments
TIL Alien Ant Farm was arrested for crashing the BET Awards to film the music video for the
song "These Days" youtube
Need help creating a very simplistic version of the gambling game CRASH.
1 upvote · 2 comments
Is dy/dx a fraction?
179 upvotes · 130 comments
TOP POSTS
Reddit
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 6/7
12/14/24, 3:18 PM Where does this "dynamic" house edge come from in Crash (betting)? : r/learnmath
https://www.reddit.com/r/learnmath/comments/qt4gca/where_does_this_dynamic_house_edge_come_from_in/?rdt=40228 7/7