private void GenerateRandom() { CSPRng rng = new CSPRng(); Verify(SparseTernaryPolynomial.GenerateRandom(743, 248, 248, rng)); for (int i = 0; i < 10; i++) { int N = rng.Next(2000) + 10; int numOnes = rng.Next(N); int numNegOnes = rng.Next(N - numOnes); Verify(SparseTernaryPolynomial.GenerateRandom(N, numOnes, numNegOnes, rng)); } }
/// <summary> /// Test the validity of the DenseTernaryPolynomial implementation /// </summary> /// /// <returns>State</returns> public string Test() { try { CheckTernarity(PolynomialGeneratorForTesting.generateRandom(1499)); CSPRng rng = new CSPRng(); for (int i = 0; i < 10; i++) { int N = rng.Next(2000) + 10; int numOnes = rng.Next(N); int numNegOnes = rng.Next(N - numOnes); CheckTernarity(DenseTernaryPolynomial.GenerateRandom(N, numOnes, numNegOnes, rng)); } OnProgress(new TestEventArgs("Passed DenseTernaryPolynomial Ternarity")); return(SUCCESS); } catch (Exception Ex) { string message = Ex.Message == null ? "" : Ex.Message; throw new Exception(FAILURE + message); } }