Macaulay2 » Documentation
Packages » random > random(ZZ,Ring)
next | previous | forward | backward | up | index | toc

random(ZZ,Ring) -- get a random homogeneous element from a graded ring

Synopsis

Description

i1 : R = ZZ[x,y]

o1 = R

o1 : PolynomialRing
i2 : random(5, R)

       5    4      3 2     2 3       4     5
o2 = 8x  + x y + 3x y  + 7x y  + 8x*y  + 3y

o2 : R
i3 : R = GF(25, Variable => a)[x, y];
i4 : VerticalList for i to 6 list random(3, R)

     {      3            2               2           3}
o4 = {- 2a*x  + (2a - 2)x y + (2a + 1)x*y  + (a + 2)y }
     {         3      2               2       3       }
     {(2a + 1)x  - a*x y + (2a - 1)x*y  + 2a*y        }
     {         3            2              2       3  }
     {(2a + 1)x  + (2a - 1)x y + (a - 2)x*y  - 2a*y   }
     {        3       2              2    3           }
     {(a + 1)x  - 2a*x y + (a + 1)x*y  + y            }
     {        3              2          2       3     }
     {(a + 1)x  + (- 2a + 1)x y - 2a*x*y  + 2a*y      }
     {        3     2              2     3            }
     {(a + 1)x  + 2x y + (a - 2)x*y  + 2y             }
     {           3     2              2              3}
     {(- 2a - 2)x  - 2x y + (a + 1)x*y  + (- 2a + 1)y }

o4 : VerticalList

The length of d, if it's a list, should be the same as degree rank of $R$.

See also

Ways to use this method: