コード例 #1
0
        /// <summary>
        /// Tests random polynomials of degree (n+1) until an irreducible is found and stores the result in <c>field polynomial</c>.
        /// This can take very long for huge degrees.
        /// </summary>
        ///
        /// <returns>Returns true</returns>
        private bool TestRandom()
        {
            int  l;
            bool done = false;

            FieldPoly = new GF2Polynomial(DegreeN + 1);
            l         = 0;

            while (!done)
            {
                l++;
                FieldPoly.Randomize();
                FieldPoly.SetBit(DegreeN);
                FieldPoly.SetBit(0);
                if (FieldPoly.IsIrreducible())
                {
                    done = true;
                    return(done);
                }
            }

            return(done);
        }
コード例 #2
0
        /// <summary>
        /// Tests random polynomials of degree (n+1) until an irreducible is found and stores the result in <c>field polynomial</c>.
        /// This can take very long for huge degrees.
        /// </summary>
        /// 
        /// <returns>Returns true</returns>
        private bool TestRandom()
        {
            int l;
            bool done = false;

            FieldPoly = new GF2Polynomial(DegreeN + 1);
            l = 0;

            while (!done)
            {
                l++;
                FieldPoly.Randomize();
                FieldPoly.SetBit(DegreeN);
                FieldPoly.SetBit(0);
                if (FieldPoly.IsIrreducible())
                {
                    done = true;
                    return done;
                }
            }

            return done;
        }
コード例 #3
0
 /// <summary>
 /// Assign a random value to this GF2nPolynomialElement using the specified source of randomness
 /// </summary>
 ///
 /// <param name="Rnd">The source of randomness</param>
 private void Randomize(Random Rnd)
 {
     polynomial.ExpandN(mDegree);
     polynomial.Randomize(Rnd);
 }
コード例 #4
0
 /// <summary>
 /// Assign a random value to this GF2nPolynomialElement using the specified source of randomness
 /// </summary>
 ///
 /// <param name="Rnd">The source of randomness</param>
 private void Randomize(Random Rnd)
 {
     m_polynomial.ExpandN(m_Degree);
     m_polynomial.Randomize(Rnd);
 }