Skip to content

Instantly share code, notes, and snippets.

@grossvogel
Created May 17, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grossvogel/884ab4b3b980d59835e55d88cbfa82da to your computer and use it in GitHub Desktop.
Save grossvogel/884ab4b3b980d59835e55d88cbfa82da to your computer and use it in GitHub Desktop.
/**
* Size in the case of polynomials will be the length of the coefficients array,
* which is one more than the degree of the polynomial
* For simplicity, use integer coefficients
* @param {Integer} size
*/
const generator = size => {
const coefficients = [];
for (i = 0; i < size; i++) {
coefficients.push(jsc.random(-MAX_COEFFICIENT, MAX_COEFFICIENT));
}
return new Polynomial(coefficients);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment