Random numbers and an Out of Bounds exception teaming up to annoy me.

I'm writing a program to test the Monty Hall problem. I have most of it figured out (though I'm sure I made it more difficult that I had to), I'm just getting an Out of Bounds Exception and I'm not sure why.

The code's kinda long so I'll just post the part bothering me.

Code:

` `

import java.util.Random;

public class Main

{

public static void main(String[] args)

{

Random randomNum;

int doors[];

for (int i=0; i<100000; i++)

{

//put car behind random door

randomNum = new Random();

int a = (randomNum.nextInt())%3;

doors = new int[3];

for (int j=0; j<3; j++)

doors[j]= 1;

doors[a]+= 1;

//player chooses random door

int b = (randomNum.nextInt())%3;

doors[b]= doors[b]+1;

a and b should randomly be 0, 1 or 2. Then I'm trying to add 1 to the number in doors[a] and doors[b], to tell me where the car is and which door the person chose.

If you don't know what the Monty Hall problem is, it's on Wikipedia, but it shouldn't really be necessary.

Thanks.