Created
May 17, 2019 14:45
-
-
Save grossvogel/884ab4b3b980d59835e55d88cbfa82da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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