Sup Veeky Forums

Sup Veeky Forums,
I usually hang out on /g/ but this one fits this board better.

I'm working on a gambling type website and I need some help with calculating win probabilities fluidly.

I want to average 10% hold.

Given a random number between let's say 0 and 100, I want the equation to return me a win value with the constraint being: the sum of all winnings times their probability must be 0.9 as to give me 10% hold.

So, winning nothing, or less than 1 would have to be more likely than winning 100.

I imagine the curve must look something like pic related, but I wonder about how to math this.

Thank you

correction.

What I need looks more like this

With

f(0)=-1

and [ sum n=0; 100 | f(n) ] = 0.9

I want a share of your revenues from that website.

You sure?

Your OP makes it sound like you want something like this.

I'm not sure..

I want the function to return the number I have to multiply the bet with.

User bets 10
Function says 0.5
User gets 5

with the AVERAGE value being 0.9 over the defined area of random inputs

stop helping for free you fucking faggot.
why do you think stemfags never make money? Because they're so retarded they give their help for free to people who actually can make money.
They studied what they liked, and they use you to do what they don't know how to do.

Is "value" the number the user gets or what the function says?

Sorry.
The average value returned by the function should be 0.9 (In the space between x=0 and a defined upper border).
This way there's a 10% hold.

user_bet * winfunction ( rnd_value ) would be the calculation for the winnings. In this case, the average should be user_bet * 0.9.

My second picture is crap.

Stop wasting your time and go make money if that's what you care about. It's not like I was going to spend millions in the stem field if no one helped me here.

OK and presumably there should be some circumstances that users get a net positive return? Otherwise no one would take the bet.

i.e. some values of the function should be more than 1

Exactly.
Big chance to get a bit less than your money (1)

you could get sued for part of your shit because using someone's work will be considered as a contribution in nature to your business.

Something like this? It's continuous not discrete, idk if that's an issue.

You've got two free variables so you can fiddle them about to fit any other constraints you may have.

Thank you, I will see what I can do with it. I'm having problems getting wolframalpha to understand what I want it to do.

A friend of mine has fired up mathematica and is fiddling around at the moment. I've sent him your picture, he's got a better understanding of maths.

My 2 other constraints are
f(0)=0 and f(100)=50
to get a maximum win of 50x the bet.


I have something that satisfies the constraints but the curve looks like this...

Turns out this is on a log scale.

This is what the graph looks like otherwise

Looks pretty linear, a truly evil gambling site would probably skew it to the right so there are less possible wins.

Could either be polynomial or exponential. You could fit both of these to the constraints.

Oh wait

Yeah, looks like what I said.

Could still try the polynomial approach though.

[code]
var b=55.7;
var a=50/(Math.exp(b)-1);
var sum=0;


for (var i = 0; i

Try f(x) = Ax^b, might have less of a sharp increase.

Not that user but I've been working on this. I couldn't solve for the particular solution for the exponential because I don't have enough computing power, but when I found A and b for the polynomial I got b=555553 and A=500000/100^(555555)~0. It works with the conditions you wanted but it has an extremely steep slope and I think the exponential would lead to a better distribution.

I'm going to do some pre-sorting now to get a prettier distribution.

20% of people will get nothing.
60% of people get a consolation price of ~50% their bet
20% of people get on average 3 times their bet

I will only use the exponential function to calculate the last 20%. This way you get little wins quite often and big wins not so often.

Updated constraints now are
f(0) = 1.5 (if you are in the lucky 20%, you get at least 1.5 times your bet)
f(1) = 50
avg : 3

>stop helping for free you fucking faggot.
I agree with this user. If op needs help making a website he should pay someone or figure it our himself.

Help4free