PDA

View Full Version : A Look Past Statistics



PawnXIIX
06-30-2012, 04:29 AM
Well here I am. There's... *fumbles around trying to find watch* 3 hours until I need to go to work so I was busy writing some code then I decided to more apply scratchers more in a real world setting rather than just looking at statistics in a whole.

It's very offsetting that we have a 1/7,776 chance of hitting 6 of the same item.


How often does that happen though? We know that a roulette ball has a 1/37 chance of hitting any of the spaces on a double zero wheel. Despite this there's still a 100% chance it will hit a single space. That being said statistics are very misleading. There is a chance the ball will land in the same spot twice and then it may never land in that slot again for another week. Even though the odds are 1/37 the odds are mutually exclusive, meaning that one spin doesn't have an effect on the other.

So I wrote a little program to simulate, using a pseudorandom generator, what the scratchers would give us if we had x number of trials. Lets start off simple...let's do 100 trials shall we?


Reward category: Armor
1 match: 0
2 matches: 1
3 matches: 16
4 matches: 4
5 matches: 0
6 matches: 0
Reward category: Guns
1 match: 0
2 matches: 1
3 matches: 12
4 matches: 7
5 matches: 0
6 matches: 1
Reward category: Melee
1 match: 0
2 matches: 0
3 matches: 7
4 matches: 4
5 matches: 1
6 matches: 0
Reward category: Money
1 match: 0
2 matches: 0
3 matches: 11
4 matches: 2
5 matches: 0
6 matches: 0
Reward category: RP
1 match: 0
2 matches: 2
3 matches: 11
4 matches: 7
5 matches: 0
6 matches: 0
Reward category: Vehicles
1 match: 0
2 matches: 0
3 matches: 8
4 matches: 5
5 matches: 0
6 matches: 0

This doesn't really prove much of anything. However...do you guys notice something? Despite the odds of hitting 5 of the same item going off at 1 in 259 I hit it twice in just 100 trials. Despite 4 of the same item going off 1 in 52 I hit an astonishing 29 of these prizes. If you take a look even closer you'll see that in just 100 random trials I even hit the 1/7,776 jackpot.

What does this tell me? That the odds aren't straight. I feel like the odds of getting certain tokens are weighted, and that in the case of a draw you will always get the lower prize. Every time so far that RP/money and weapons were a draw I received the RP or the money.

If anyone wants to borrow my code you can just throw this into notepad, save it as a java and run it through a compiler. I'm too lazy to upload a class file here :P

The program works in a very simple way.

1. Randomly generate 6 numbers
2. Determine the highest occurrence of prize
3. If there was a draw amongst the highest numbers: randomly pick one of those in contention
4. Repeat x number of trials, or exit


import java.util.ArrayList;
public class CCOdds
{
public static void main(String [] args)
{

//0: Armor, 1: Guns, 2: Melee, 3: Money, 4: RP, 5: Vehicle
int [][] results = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}};
int [] randomResults = new int[6];
int randomNumber, max, maxLocation, givenLocation;
boolean isDraw = false;
ArrayList<Integer> matches;

for(int i = 0; i < NUM_TRIALS; i++)
{
for(int j = 0; j < 6; j++)
randomResults[j] = 0;
System.out.print("Ticket Printed:");
for(int j = 0; j < 6; j++)
{
randomNumber = (int)(6 * Math.random());
randomResults[randomNumber]++;
}
for(int temp: randomResults)
System.out.print(" " + temp);
max = randomResults[0];
maxLocation = 0;
for(int j = 1; j < 6; j++)
{
if(randomResults[j] > max)
{
max = randomResults[j];
maxLocation = j;
isDraw = false;
}
else if(randomResults[j] == max)
isDraw = true;
}
if(isDraw)
{
isDraw = false;
matches = new ArrayList<Integer>();
for(int j = 0; j < 6; j++)
if(randomResults[j] == max)
matches.add(j);
randomNumber = (int)(matches.size() * Math.random());
givenLocation = matches.get(randomNumber);
results[givenLocation][max]++;
System.out.println(": Random Chosen by draw at location: " + givenLocation);
}
else
{
results[maxLocation][max]++;
System.out.println(": Max found at location: " + maxLocation);
}
}
for(int i = 0; i < 6; i++)
{
System.out.println("Reward category: " + REWARDS[i]);
for(int j = 0; j < 6; j++)
{
int tempAmount = j + 1;
if(j == 0)
System.out.println(" " + tempAmount + " match: " + results[i][j]);
else
System.out.println(" " + tempAmount + " matches: " + results[i][j]);
}
}
}

public static final int NUM_TRIALS = 100;
public static final String[] REWARDS = {"Armor", "Guns", "Melee", "Money", "RP", "Vehicles"};
}

Here is the full output from that run:


--------------------Configuration: CCOdds - JDK version 1.6.0_21 <Default> - <Default>--------------------
Ticket Printed: 0 2 1 1 1 1: Max found at location: 1
Ticket Printed: 0 0 3 0 3 0: Random Chosen by draw at location: 2
Ticket Printed: 2 1 0 0 2 1: Random Chosen by draw at location: 0
Ticket Printed: 1 1 1 0 3 0: Max found at location: 4
Ticket Printed: 2 1 1 0 1 1: Max found at location: 0
Ticket Printed: 0 0 2 2 0 2: Random Chosen by draw at location: 3
Ticket Printed: 1 3 1 0 0 1: Max found at location: 1
Ticket Printed: 0 2 1 2 0 1: Random Chosen by draw at location: 3
Ticket Printed: 0 1 1 1 2 1: Max found at location: 4
Ticket Printed: 1 2 0 1 0 2: Random Chosen by draw at location: 1
Ticket Printed: 1 1 2 0 1 1: Max found at location: 2
Ticket Printed: 1 0 2 1 1 1: Max found at location: 2
Ticket Printed: 2 0 1 2 1 0: Random Chosen by draw at location: 0
Ticket Printed: 1 1 1 1 2 0: Max found at location: 4
Ticket Printed: 0 1 1 2 0 2: Random Chosen by draw at location: 5
Ticket Printed: 1 0 4 1 0 0: Max found at location: 2
Ticket Printed: 1 1 0 3 1 0: Max found at location: 3
Ticket Printed: 1 1 0 2 1 1: Max found at location: 3
Ticket Printed: 1 0 0 1 2 2: Random Chosen by draw at location: 5
Ticket Printed: 1 2 1 2 0 0: Random Chosen by draw at location: 3
Ticket Printed: 2 0 2 0 0 2: Random Chosen by draw at location: 0
Ticket Printed: 3 3 0 0 0 0: Random Chosen by draw at location: 1
Ticket Printed: 1 1 1 0 2 1: Max found at location: 4
Ticket Printed: 1 1 1 2 0 1: Max found at location: 3
Ticket Printed: 1 3 1 1 0 0: Max found at location: 1
Ticket Printed: 3 0 0 0 1 2: Max found at location: 0
Ticket Printed: 0 0 0 1 3 2: Max found at location: 4
Ticket Printed: 1 1 1 2 0 1: Max found at location: 3
Ticket Printed: 0 1 1 1 0 3: Max found at location: 5
Ticket Printed: 1 0 2 0 1 2: Random Chosen by draw at location: 5
Ticket Printed: 2 1 1 1 0 1: Max found at location: 0
Ticket Printed: 2 0 1 2 0 1: Random Chosen by draw at location: 3
Ticket Printed: 1 2 0 0 1 2: Random Chosen by draw at location: 1
Ticket Printed: 3 1 0 2 0 0: Max found at location: 0
Ticket Printed: 0 1 3 2 0 0: Max found at location: 2
Ticket Printed: 2 0 0 2 1 1: Random Chosen by draw at location: 0
Ticket Printed: 0 1 3 0 1 1: Max found at location: 2
Ticket Printed: 0 1 2 0 2 1: Random Chosen by draw at location: 4
Ticket Printed: 0 1 1 1 2 1: Max found at location: 4
Ticket Printed: 1 0 1 2 1 1: Max found at location: 3
Ticket Printed: 0 0 1 0 2 3: Max found at location: 5
Ticket Printed: 1 0 2 2 1 0: Random Chosen by draw at location: 2
Ticket Printed: 2 1 1 1 1 0: Max found at location: 0
Ticket Printed: 0 1 1 2 1 1: Max found at location: 3
Ticket Printed: 0 0 0 3 0 3: Random Chosen by draw at location: 5
Ticket Printed: 1 3 0 1 1 0: Max found at location: 1
Ticket Printed: 2 0 1 0 2 1: Random Chosen by draw at location: 4
Ticket Printed: 1 1 0 1 1 2: Max found at location: 5
Ticket Printed: 1 1 1 1 2 0: Max found at location: 4
Ticket Printed: 1 1 1 1 1 1: Random Chosen by draw at location: 0
Ticket Printed: 1 1 0 3 0 1: Max found at location: 3
Ticket Printed: 0 2 0 2 2 0: Random Chosen by draw at location: 1
Ticket Printed: 1 1 2 1 0 1: Max found at location: 2
Ticket Printed: 2 1 1 0 2 0: Random Chosen by draw at location: 0
Ticket Printed: 1 1 1 1 1 1: Random Chosen by draw at location: 1
Ticket Printed: 1 0 1 1 1 2: Max found at location: 5
Ticket Printed: 2 0 0 2 1 1: Random Chosen by draw at location: 0
Ticket Printed: 1 2 1 0 1 1: Max found at location: 1
Ticket Printed: 2 1 0 0 2 1: Random Chosen by draw at location: 0
Ticket Printed: 0 1 2 1 2 0: Random Chosen by draw at location: 2
Ticket Printed: 1 3 0 0 0 2: Max found at location: 1
Ticket Printed: 1 0 1 1 2 1: Max found at location: 4
Ticket Printed: 2 0 0 1 2 1: Random Chosen by draw at location: 4
Ticket Printed: 1 2 1 1 1 0: Max found at location: 1
Ticket Printed: 0 0 3 1 2 0: Max found at location: 2
Ticket Printed: 0 5 0 0 0 1: Max found at location: 1
Ticket Printed: 0 0 0 1 3 2: Max found at location: 4
Ticket Printed: 0 2 0 1 3 0: Max found at location: 4
Ticket Printed: 1 1 1 1 1 1: Random Chosen by draw at location: 4
Ticket Printed: 1 2 1 1 0 1: Max found at location: 1
Ticket Printed: 2 0 2 0 1 1: Random Chosen by draw at location: 0
Ticket Printed: 3 1 2 0 0 0: Max found at location: 0
Ticket Printed: 1 0 0 2 0 3: Max found at location: 5
Ticket Printed: 1 0 1 1 0 3: Max found at location: 5
Ticket Printed: 0 3 2 0 1 0: Max found at location: 1
Ticket Printed: 1 1 2 0 2 0: Random Chosen by draw at location: 2
Ticket Printed: 1 0 2 0 3 0: Max found at location: 4
Ticket Printed: 2 1 1 1 1 0: Max found at location: 0
Ticket Printed: 2 1 1 1 1 0: Max found at location: 0
Ticket Printed: 1 1 1 1 1 1: Random Chosen by draw at location: 4
Ticket Printed: 1 1 0 2 0 2: Random Chosen by draw at location: 5
Ticket Printed: 0 3 0 2 0 1: Max found at location: 1
Ticket Printed: 1 2 1 0 1 1: Max found at location: 1
Ticket Printed: 0 1 2 1 0 2: Random Chosen by draw at location: 5
Ticket Printed: 1 2 1 1 1 0: Max found at location: 1
Ticket Printed: 2 0 1 2 1 0: Random Chosen by draw at location: 3
Ticket Printed: 0 2 1 0 2 1: Random Chosen by draw at location: 1
Ticket Printed: 1 1 0 0 3 1: Max found at location: 4
Ticket Printed: 1 0 1 1 1 2: Max found at location: 5
Ticket Printed: 0 1 0 1 3 1: Max found at location: 4
Ticket Printed: 0 1 0 2 2 1: Random Chosen by draw at location: 3
Ticket Printed: 0 2 1 1 2 0: Random Chosen by draw at location: 1
Ticket Printed: 1 0 0 1 2 2: Random Chosen by draw at location: 4
Ticket Printed: 1 1 2 0 0 2: Random Chosen by draw at location: 2
Ticket Printed: 1 2 1 0 1 1: Max found at location: 1
Ticket Printed: 2 1 0 1 1 1: Max found at location: 0
Ticket Printed: 2 2 1 0 0 1: Random Chosen by draw at location: 0
Ticket Printed: 1 0 1 0 2 2: Random Chosen by draw at location: 4
Ticket Printed: 3 0 0 0 3 0: Random Chosen by draw at location: 0
Ticket Printed: 2 0 0 1 1 2: Random Chosen by draw at location: 0
Reward category: Armor
1 match: 0
2 matches: 1
3 matches: 16
4 matches: 4
5 matches: 0
6 matches: 0
Reward category: Guns
1 match: 0
2 matches: 1
3 matches: 12
4 matches: 7
5 matches: 0
6 matches: 1
Reward category: Melee
1 match: 0
2 matches: 0
3 matches: 7
4 matches: 4
5 matches: 1
6 matches: 0
Reward category: Money
1 match: 0
2 matches: 0
3 matches: 11
4 matches: 2
5 matches: 0
6 matches: 0
Reward category: RP
1 match: 0
2 matches: 2
3 matches: 11
4 matches: 7
5 matches: 0
6 matches: 0
Reward category: Vehicles
1 match: 0
2 matches: 0
3 matches: 8
4 matches: 5
5 matches: 0
6 matches: 0

Process completed.

ShawnBB
06-30-2012, 04:39 AM
I noticed that there are only 4 times of 2 matches and 0 times of 1 match.
100 sample size is not enough maybe...

PawnXIIX
06-30-2012, 04:58 AM
1 Match is when you have 1 of every single item. I think I should reword it a little.

Well here's 1000 sample size (With corrected semantics):


Reward category: Armor
0 matches: 0
1 match: 0
2 matches: 109
3 matches: 65
4 matches: 10
5 matches: 0
Reward category: Guns
0 matches: 0
1 match: 5
2 matches: 108
3 matches: 50
4 matches: 9
5 matches: 0
Reward category: Melee
0 matches: 0
1 match: 0
2 matches: 97
3 matches: 42
4 matches: 4
5 matches: 0
Reward category: Money
0 matches: 0
1 match: 1
2 matches: 115
3 matches: 52
4 matches: 5
5 matches: 4
Reward category: RP
0 matches: 0
1 match: 2
2 matches: 114
3 matches: 51
4 matches: 2
5 matches: 0
Reward category: Vehicles
0 matches: 0
1 match: 0
2 matches: 96
3 matches: 55
4 matches: 4
5 matches: 0


Oh my god 4 times hit the big $10,000,000 prize *headdesk*

I see where you're going with this, I can't really make an explanation. The numbers are randomly generated with 6 * Math.random which picks a double between 0 and 1 inclusive.