不知道研究这些干啥,纯纯的浪费时间。。。
public static double TQSquare(double number){Random random1 = new Random(DateTime.Now.Millisecond);double x1 = 0, resultX1 = 0, diff = 9999999999, diffTemporary = 0;for (int i = 0; i < 654321; i++){if (random1.Next(0, 100) % 2 == 0){x1 = resultX1 + random1.NextDouble() * 1000;}else{x1 = resultX1 - random1.NextDouble() * 1000;}diffTemporary = Math.Abs(x1 * x1 - number);if (diffTemporary < diff){resultX1 = x1;diff = diffTemporary;}if (diff<0.001){break;}}return Math.Abs(resultX1);}