Polynomial factorization over Fp

JavaScript port of main.cpp (Modern Computer Algebra, Ch. 14): distinct-degree factorization, equal-degree splitting and the full factorization of a random monic polynomial. The random generator emulates glibc's rand(), so a seed gives the same output as the C++ binary. This JavaScript port was generated by Claude (Anthropic).