예제 #1
0
 public static float SinRate(ISensor eye, int lifeTime)
 {
     var god = new GodsEye();
     var random = new Random();
     var sinCount = 0;
     for (var i = 0; i < lifeTime; i++)
     {
         var blackOrWhite = random.Next(0, 2) == 0 ? Real.Black : Real.White;
         eye.Poke(blackOrWhite);
         god.Poke(blackOrWhite);
         if (eye.Peek != god.Peek)
             sinCount++;
     }
     return (float)sinCount / lifeTime;
 }