One way to talk about it precisely is in your program (great program btw). When running the program, you clearly demonstrate a difference in correlation when only "local" vs. "non-Local" variables are used. In order to help understand your program, I have modified some defaults on the program, added a log so you can see the results of each pair measurement and placed a copy here. I see from the program that in the "Non-Local" mode you generate a pair, then take a first measure of the orientation. Using the first measure, you set the orientation of the other photon to match the measurement of the first photon, then the second photon orientation is measured. You get 100% correlation because of the resetting of the second photon after measuring the first. In the "Local" mode, you generate the pair and measure each photon independently. I see you have introduced some randomness in the measurement and sure enough, some of the pairs do not measure the same on both ends. This means you do not get 100% correlation anymore. In my opinion to answer your question on how to make "locality" work with your program, do what many experiments of this type do. They dont count the mis-matches in the correlation totals and assume the mis-matches were not entangled in the first place. It is important to point out that you can make the "Local" mode work in your program by assuming that any of the pairs that did not match were noise and dont count them in the correlation measurement. Your "Local" mode will have 100% correlation and will match reality!