private static readonly Random Random = new Random();
private bool _measured = false;
public bool A { get; private set; }
public bool B { get; private set; }
public bool C { get; private set; }
public Particle(bool a, bool b, bool c)
public bool GetValue(int sensorPosition)
throw new InvalidOperationException("Измерить можно только один раз!");
throw new ArgumentOutOfRangeException();
public class EntanglementParticles
public Particle First { get; private set; }
public Particle Second { get; private set; }
public EntanglementParticles()
} while (a == b && b == c);
First = new Particle(a, b, c);
Second = new Particle(a, b, c);
public static void Main(string[] args)
private static void Experiment1()
var totalAttempts = 10000;
var coincidenceCount = 0;
for (int attemptNumber = 1; attemptNumber <= totalAttempts; attemptNumber++)
var entanglementParticles = new EntanglementParticles();
var position = GetRandomInteger(1, 3);
int firstSensorPosition = position;
int secondSensorPosition = position;
bool firstValue = entanglementParticles.First.GetValue(firstSensorPosition);
bool secondValue = entanglementParticles.Second.GetValue(secondSensorPosition);
if (firstValue == secondValue)
Console.WriteLine("Эксперимент №1: {0}% значений совпало", (decimal)coincidenceCount / totalAttempts * 100);
private static void Experiment2()
var totalAttempts = 10000;
var coincidenceCount = 0;
for (int attemptNumber = 1; attemptNumber <= totalAttempts; attemptNumber++)
var entanglementParticles = new EntanglementParticles();
int firstSensorPosition = GetRandomInteger(1, 3);
int secondSensorPosition = GetRandomInteger(1, 3);
bool firstValue = entanglementParticles.First.GetValue(firstSensorPosition);
bool secondValue = entanglementParticles.Second.GetValue(secondSensorPosition);
if (firstValue == secondValue)
Console.WriteLine("Эксперимент №2: {0}% значений совпало", (decimal)coincidenceCount / totalAttempts * 100);
private static bool GetRandomBoolean()
return GetRandomInteger(0, 1) == 1;
private static int GetRandomInteger(int from, int to)
return Random.Next(from, to + 1);