Jump to content

Recommended Posts

$card1 = rand(1,3);
$card2 = rand(1,3);

/// check money win ////////
if($card1 == "1" && $card2 == "1" ){
echo "You won 100$?";
exit;
mysql_query("UPDATE card SET money='$win_money' WHERE name='$name'");
}

 

My code works wonderfully

 

prob tho

how can I show the odds of winning out of 100 to my suer?

Link to comment
https://forums.phpfreaks.com/topic/255992-how-do-i-show-the-odds/
Share on other sites

google found me this http://gwydir.demon.co.uk/jo/probability/calcdice.htm#cond1

 

and thats on dice, but i figured dice are 6 and yours are 3, so i came up with 1 in 6, as each one has a 1 in 3 chance

 

'm not to good on odd calculating but the link might help a bit

If you have 3 picks from a pool of 36 numbers, and none of the numbers can repeat, the chances are 36*(36-1)*(36-2), or 1 in 42840. How to calculate the chances if the order of the numbers picked is required to match the order of the numbers drawn, I don't know.

Im still confused

 

$card1 = rand(1,4);
$card2 = rand(1,4);
if ($ibforums->input['id'] == "1"){
if($card1 == "1" && $card2 == "1"){

 

if my stuff is 1 in 4 chances

 

and it both has to equal the same "1"

 

that would be 25% divided by 2

 

which is

12.5% of winning right?

 

Again, basic statistics have nothing to do with PHP.  You want to study basic probability.

 

The probability of the first number being 1 is 1/4.  The probability of the second number being 1 is also 1/4.  You multiply the odds together to get your answer: 1/4 x 1/4 = 1/16, or 6.25%

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.