chinese-remainder
Version:
A lightweight NPM package for solving modular equations using the Chinese Remainder Theorem (CRT). Supports modular inverse, LCM, and GCD calculations.
9 lines (6 loc) • 347 B
JavaScript
function generateRandomCRTSystem(count, maxModulus) {
const remainders = Array.from({ length: count }, () => Math.floor(Math.random() * maxModulus));
const moduli = Array.from({ length: count }, () => Math.floor(Math.random() * maxModulus) + 1);
return { remainders, moduli };
}
module.exports = generateRandomCRTSystem;