def gf_irreducible(n, p, K):
 while True:
  f = gf_random(n, p, K)
  if gf_irreducible_p(f, p, K):
   return f

def gf_irreducible ( n , p , K ) : while True : f = gf_random ( n , p , K ) if gf_irreducible_p ( f , p , K ) : return f
generate random irreducible polynomial of degree n in gf(p)[x] .