References:

http://www.askamathematician.com/2010/06/q-how-it-is-that-bells-theorem-proves-that-there-are-no-hidden-variables-in-quantum-mechanics-how-do-we-know-that-god-really-does-play-dice-with-the-universe/

http://en.wikipedia.org/wiki/Malus%27s_law#Malus.27_law_and_other_properties

**Malus's law simulation and spooky action at distance**

L1= (rand()%100 < ((cos(P1) * cos(P1)) * 100)) ? 1:0

L2= (rand()%100 < ((cos(P2) * cos(P2)) * 100)) ? 1:0

Using Malus's law calculate probability of photon L1 passing through polarizer P1, and L2 through P2. If random number between 0 and 100 is less than photon's probability percentage the photon goes through (= 1), otherwise it gets blocked (= 0).

if (L1 == L2) MATCH++ else MISMATCH++

RESULT= (MATCH - MISMATCH)/(N_MEASURE/100))

If both L1 and L2 passed through (1 = 1) or both got stopped (0 = 0) increase matching pairs counter, otherwise increase opposite pairs counter. That's all, just like in the experiment. Here is roughly what's happening with 100 photon pairs sequences:

P1= -25 -> Malus's law -> 82% ~ 82 out of 100

P2= 25 -> Malus's law -> 82% ~ 82 out of 100

0111110011 1111111011 1111100111 1111111111 1111111110 1101111011 0111101110 1111111111 1111111111 1111101111 1111111111 1110111011 1111001111 1111111101 0111111101 0011011111 1011111011 1111110001 1110001111 1101110111

match= 71

mismatch= 29

num_data= 100

Result: (71-29)/(100/100) = 42%

QM prediction: cos^2(50) * 100 = 41.32%

Ooops, this was supposed to be impossible. So Quantum Mechanics is just misunderstood classical physics. Awwww.