Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Probability program equation in app.

  1. Jul 10, 2013 #1
    Hi there,

    I am getting an iphone/android app developed and there is a new part that needs to be programmed.

    A store can create a free offer and assign the random probability odds of winning that prize.
    If they create 3 offers for their restaurant with the following win odds.(they can have as many prizes as they want so the equation/code must be dynamic so based on the number of prizes the formula should always give out the correct prizes0

    Prize 1 = Free starter with win odds 10:1
    Prize 2 = Free main course with win odds 50:1
    Prize 3 = Free main course with win odds 200:1

    When the app user goes into the store they scan a barcode. This is where I am stuck, I want the user to have a chance to win any of the prizes and for the correct amount of people to have won a prize as I don't want the equation/code to be wrong and the store has to give out much more free stuff than what they had bargained for,I also don't want too few winners as people will stop using it if they are not winning.

    Can anyone suggest the best way to code for this(I have no programming experience but have a team in India programming it but want to give them proper instructions). I was thinking the only way that it could be done is when you scan the barcode the program code will randomly select one of the prizes available and then apply the random odds of that prize to see if you won.

    Is there a better way to approach this?
    Is there a way to combine the odds?

    Can anybody suggest how I can get this section to work right. If you need more info please post and I can answer.

    Thanks in advance,
  2. jcsd
  3. Jul 10, 2013 #2


    User Avatar
    2017 Award

    Staff: Mentor

    Where does the barcode come from, and do many users get the same barcode?
    In other words, do you want that the barcode determines who wins?

    If not, how is the barcode related to that?
    Do you want random winners, based on nothing else but the app and chance? In that case, it looks dangerous to let the user app do that, as it could be manipulated (or tricked, by scanning an arbitrary barcode generated by the user).
    Do you plan some control mechanism, and how does it work?
  4. Jan 13, 2014 #3


    User Avatar
    2017 Award

    Staff: Mentor

    This thread is half a year old and Logger didn't return to clarify the problem.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook