# Revision history [back]

### Random polynomial of degree 1

I defined polynomial ring like this. Here is K is finite field of size 4 in 'a'

R1=PolynomialRing(K,['z%s'%p for p in range(1,3)])


When I call random_element function

R1.random_element()


I get the following output,

(a)*z1*z2 + (a + 1)*z2^2 + z1 + (a)*z2


But I only want a random linear polynomial from this ring? How can I do it?

I would be grateful for the help.

 2 None slelievre 17654 ●22 ●160 ●348 http://carva.org/samue...

### Random polynomial of degree 1

I defined polynomial ring like this. Here is K is Having defined

• the finite field K of size 4 in 'a'a
• a polynomial ring R1 over K

one can ask for a random element using the random_element method.

The random polynomial I obtained that way was of degree two:

R1=PolynomialRing(K,['z%s'%p sage: K.<a> = FiniteField(4)
sage: R1 = PolynomialRing(K, ['z%s' % p for p in range(1,3)])


When I call random_element function

range(1, 3)])
sage: R1.random_element()


I get the following output,

(a)*z1*z2 + (a + 1)*z2^2 + z1 + (a)*z2


But If I only want a random linear polynomial from this ring? How ring, how can I do it?

I would be grateful for the help.get one?