This is documented (almost). The routine generates polynomials with degrees in a given range, with by default is -1..2 . It chooses the degree uniformly (the documentation doesn't specify this), so one would expect 33% degree -1, i.e., the 0 poly. I have a hard time thinking of situations where this is the distribution one would want.
Over a finite field perhaps you're more interested in the uniform distribution on polynomials of degree at most N. Then Kx([GF(p).random_element() for _ in range(N+1)]) would be better. On Saturday 30 December 2023 at 04:43:44 UTC-8 Georgi Guninski wrote: > Just FYI: > > def testquotient2(): > set_random_seed(1);p=next_prime(10**120);Kx=Integers(p)['x'] > l=[Kx.random_element() for _ in range(100)] > return l.count(0) > testquotient2() > 27 > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/61b0120b-9d2a-4470-a00a-d64cd65707f7n%40googlegroups.com.