# random(ZZ,Ideal) -- get a random homogeneous element from a graded ideal

## Synopsis

• Function: random
• Usage:
random(d, I)
random(L, I)
• Inputs:
• d, an integer, an integer or a list, the degree, multi-degree, or a list of degrees;
• I, an ideal, in a graded ring;
• Optional inputs:
• Density => ..., default value 1, get a random map of module
• Height => ..., default value 10, get a random homogeneous element from a graded ring
• MaximalRank => ..., default value false, get a random map of module
• UpperTriangular => ..., default value false, get a random map of module
• Outputs:
• , or a list, homogeneous element(s) with prescribed degrees;

## Description

This function produces one or more homogeneous elements of an ideal.

 i1 : S = ZZ/101[x, y] o1 = S o1 : PolynomialRing i2 : I = ideal"x2, y2" 2 2 o2 = ideal (x , y ) o2 : Ideal of S i3 : random(2, I) 2 2 o3 = 24x - 36y o3 : S i4 : random({2}, I) 2 2 o4 = - 30x - 29y o4 : S i5 : random({2, 3}, I) 2 2 3 2 2 3 o5 = {19x + 19y , - 10x - 8x y - 29x*y - 22y } o5 : List i6 : random({{2}, {3}}, I) 2 2 3 2 2 3 o6 = {- 29x - 24y , - 38x + 39x y - 16x*y + 21y } o6 : List i7 : R = ZZ/101[x, y, z, Degrees => {{1,0}, {-1,1}, {0,1}}] o7 = R o7 : PolynomialRing i8 : J = ideal"x2, y2, z2" 2 2 2 o8 = ideal (x , y , z ) o8 : Ideal of R i9 : random({2, 2}, J) 4 2 3 2 2 o9 = - 5x y + 19x y*z + 36x z o9 : R i10 : random({{2, 2}}, J) 4 2 3 2 2 o10 = {- 41x y - 43x y*z + 39x z } o10 : List i11 : random(toList(3:{1, 1}), J) 2 2 2 o11 = {38x y, 2x y, 16x y} o11 : List

## Caveat

Note that in the single graded case, the input {d} is treated as a multidegree of length one rather than a list of length one, hence the output is one polynomial, while {{d}} is treated as a list containing a single multidegree of length one and therefore the output is a list containing a single polynomial.