diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md index 93161765e9..c08b83a9af 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md @@ -29,12 +29,12 @@ Use this technique to generate and return a random whole number between 0< tests: - text: The result of randomWholeNum should be a whole number. testString: assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})()); - - text: You should be using Math.random to generate a random number. - testString: assert(code.match(/Math.random/g).length > 1); + - text: You should use Math.random to generate a random number. + testString: assert(code.match(/Math.random/g).length >= 1); - text: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine. testString: assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g)); - text: You should use Math.floor to remove the decimal part of the number. - testString: assert(code.match(/Math.floor/g).length > 1); + testString: assert(code.match(/Math.floor/g).length >= 1); ``` @@ -46,8 +46,6 @@ tests:
```js -var randomNumberBetween0and19 = Math.floor(Math.random() * 20); - function randomWholeNum() { // Only change code below this line @@ -75,7 +73,6 @@ function randomWholeNum() { ```js -var randomNumberBetween0and19 = Math.floor(Math.random() * 20); function randomWholeNum() { return Math.floor(Math.random() * 10); }