Well I'll Be Damned. I wrote a little program also to verify. It's totally legit..

Jib
March 31, 2009 02:09PM
Turns out that choosing the other door is indeed 66%. While choosing your door is 33%.

Pretty significant difference.

Other interesting results is that if there are four total doors choosing the "other" door goes from 25% (1/4) to ~37%.

with ten doors it goes from something like 10% to 11%...

If anyone cares to nerd out, the following is a .c program and can be compiled with gcc and ran.

pass it a "1" option and you'll choose the "other" door..

<pre>
#include "stdlib.h"

#define NUM_DOORS 3

#define PASSES 100000

static int gs_iLosses;
static int gs_iWins;

static int gs_iChooseOtherDoor;


int main(int argc, char *argv[])
{
// if 1 is passed as argument then we'll choose the "other" door.
if(argc > 1 && atoi(argv[1]) == 1) {
printf("Choosing the OTHER door....\n");
gs_iChooseOtherDoor = 1;
} else {
printf("Sticking with OUR door...\n");
gs_iChooseOtherDoor = 0;
}

// random seed
unsigned int iseed = (unsigned int)time(NULL);
srand(iseed);

gs_iLosses = 0;
gs_iWins = 0;

int i = 0;
for(i = 0; i < PASSES; i++) {
if(SelectDoor() == 1) {
gs_iWins++;
} else {
gs_iLosses++;
}
}

printf("Wins:%d\n",gs_iWins);
printf("Losses:%d\n",gs_iLosses);
printf("(%ld%% Wins)\n",(gs_iWins*100)/PASSES);

return 0;
}

int SelectDoor() {

// now get one winner door. THIS CAN BE ANYTHING.
int iWinnerIdx = getRandomIndex(NUM_DOORS);

// now select OUR random door. THIS CAN BE ANYTHING.
int iSelectedDoorIdx = getRandomIndex(NUM_DOORS);

// now let's get the door which ISN'T the winner and ISN'T our door.
// This is the one we see and will NOT CHOOSE BECASE ITS A LOSER.
int iLosingNonSelectedDoorIdx = getRandomIndex(NUM_DOORS);
while((iLosingNonSelectedDoorIdx == iSelectedDoorIdx) ||
(iLosingNonSelectedDoorIdx == iWinnerIdx)) {
iLosingNonSelectedDoorIdx = getRandomIndex(NUM_DOORS);
}

if(gs_iChooseOtherDoor) {
// now let's select the unselected door (aka "Other door")...
// We don't care about winner idx, we just want NOT our door and NOT the loser door...
int iNewSelectedDoorIdx = getRandomIndex(NUM_DOORS);
while((iNewSelectedDoorIdx == iSelectedDoorIdx) ||
iNewSelectedDoorIdx == iLosingNonSelectedDoorIdx) {
iNewSelectedDoorIdx = getRandomIndex(NUM_DOORS);
}
iSelectedDoorIdx = iNewSelectedDoorIdx;
}

// Now Let's see if we won!!!
if(iSelectedDoorIdx == iWinnerIdx) {
return 1;
}
return 0;
}

// random number 0-n
int getRandomIndex(int _iMax) {
int iRand = rand();
return iRand/(int)(((unsigned)RAND_MAX + 1) / _iMax);
}


</pre>



Edited 2 time(s). Last edit at 03/31/2009 02:13PM by Jib.
Subject Author Posted

in the same vein as the 0.999... = 1.0 thread...txt

Isildur(VIP) March 30, 2009 06:25PM

I understand the probability arguments behind this

vortex_magus April 01, 2009 12:02AM

This is how it makes sense for me:

PaulO April 01, 2009 06:49AM

Check it:

Jib April 01, 2009 01:10AM

What if...

Darbhi April 01, 2009 01:02AM

Re: What if...

Isildur(VIP) April 01, 2009 07:48AM

Of course you switch.

WarEagle March 31, 2009 07:35PM

21 was a shitty movie. Just leave it at that? nt

cartherlen March 31, 2009 04:07AM

Closet Kevin Spacey fan

entropissed March 31, 2009 05:13AM

Switch doors.

Java March 30, 2009 06:45PM

Not necessarily

naddok March 30, 2009 09:25PM

Re: Not necessarily

Isildur(VIP) March 31, 2009 03:23AM

You still need to know whether it was intentional

naddok March 31, 2009 07:20PM

Re: You still need to know whether it was intentional

Isildur(VIP) March 31, 2009 08:09PM

It does matter

naddok March 31, 2009 08:33PM

Re: It does matter

Isildur(VIP) March 31, 2009 08:41PM

Re: It does matter

naddok March 31, 2009 08:55PM

No you don't.

Death_Claw April 03, 2009 12:39PM

Re: It does matter

Isildur(VIP) April 01, 2009 04:06AM

Consider the following

naddok April 01, 2009 09:33PM

Re: Consider the following

Isildur(VIP) April 02, 2009 05:11AM

Re: Consider the following

DurNominator(VIP) April 02, 2009 10:17PM

Now we're getting somewhere

naddok April 02, 2009 07:04PM

Are you serious? Math doesn't care about the intention of variables.

Java April 02, 2009 08:59PM

Re: Are you serious? Math doesn't care about the intention of variables.

DurNominator(VIP) April 02, 2009 10:42PM

Nope..

Java April 03, 2009 04:57AM

Actually...

Darbhi April 03, 2009 05:32AM

You are fucking stupid.

Java April 03, 2009 05:11PM

I'll try to explain it to you once again

DurNominator(VIP) April 04, 2009 02:04AM

Damn, you are thick. n/t

Darbhi April 03, 2009 05:17PM

I prefer the term "correct". And yes, I am, thank you.

Java April 03, 2009 05:23PM

Re: I prefer the term "correct". I am "correct". And yes, I am, thank you.

Darbhi April 03, 2009 05:30PM

Stop and think for a moment

naddok April 02, 2009 09:59PM

Ok, but...

Java April 03, 2009 05:04AM

Hey, we agree on something!

naddok April 03, 2009 06:19PM

Re: simulation

PaulO April 01, 2009 06:25AM

Re: simulation

Isildur(VIP) April 01, 2009 06:35AM

Re: simulation

PaulO April 01, 2009 06:41AM

In other words: Isildur is smart. Naddok is dumb. nt

Java April 01, 2009 05:34AM

I'd rather be right, which I am. n/t

naddok April 02, 2009 07:05PM

You're right. The rest of the world, including demonstrated simulations.. is wrong. Of course. I'm the stupid one, not you. You're not a dumb fucking retard at all. nt

Java April 02, 2009 08:57PM

But for all intents and purposes, assuming the host didn't open the right door, Java/Rade are correct. nt

istirith March 30, 2009 11:00PM

Huh?

Tiberius Odgen March 31, 2009 06:05AM

It does, it's a mathematical trick

cyril March 31, 2009 06:41AM

You actually have a 66% chance of being right if you change choices.

Death_Claw March 31, 2009 10:46AM

Well I'll Be Damned. I wrote a little program also to verify. It's totally legit..

Jib March 31, 2009 02:09PM

Re: You actually have a 66% chance of being right if you change choices.

Darbhi March 31, 2009 01:45PM

You're right. n/t

cyril March 31, 2009 11:54AM

Yikes. You're right, I'm wrong.

Tiberius Odgen March 31, 2009 07:21AM

Aaaah. Now I see. lol. thanks. nt

Tiberius Odgen March 31, 2009 07:25AM

Re: in the same vein as the 0.999... = 1.0 thread...txt

Rade March 30, 2009 06:29PM

Explanation (in case anyone is interested)

Rade March 30, 2009 06:41PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 129
Record Number of Users: 2 April 29, 2024
Record Number of Guests: 258 May 03, 2024