Igor Schein on Tue, 15 Dec 1998 12:14:50 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

interesting *randomness* issue


Hi, I noticed something weird:

? randpol(d,b)=x^d+sum(k=0,d-1,(random(2*b+1)-b)*x^k)
? v=[];for(k=1,2000,t=randpol(8,2);if(polisirreducible(t),polgalois(t),);v=concat(v,[t])) 
? matsize(v)
[1, 2000]
? length(Set(v))
816

So first I define a function which returns a random monic polynomial
of degree d and absolute value of coefficients <= b

Then I generate 2000 random polynomials of degree 8 and run
polgalois() on those which are irreducible.  From the 4th command
it's clear that they're not random anymore.  And indeed, if you print
the vector v above, you'll see that it hits a loop of length 8 in the
end of the first 1000, and loops forever.  

However, if I use degree 7 polynomials instead, the pseudo-randomness
is fine.  

So I am curious how come polgalois() causes random number generator to 
go berserk.

Thanks
Igor