#Scrambled Number Generator
- Plan your execution on white board before forking and cloning.
- Fork and clone the project.
- Set up your file structure.
- [Folder] Scrambled-Number-Generator
- [Folder] js
- generator.js
- [Folder] spec
- generator-spec.js
- [Folder] js
- [Folder] Scrambled-Number-Generator
- Install npm, mocha, and chai from your Scrambled-Number-Generator folder
$ npm init
$ npm install -D mocha chai
- Write unit tests for the generator in generator-spec.js. Commit!
- Include either or both declations in your spec.js, depending on what syntax you want to use:
var should = chai.should(); var expect = chai.expect;
- Also include
var chai = require("chai"); var generator = require("../js/generator.js");
- Be logical and atomic in your unit tests.
- Run your tests by running mocha.
mocha ./spec
- Implement the generator in generator.js. Commit!
- Function name : generate
- Takes "amount", the amount of numbers to generate, counting from 0 to "amount" - 1
- Returns an array containing the specified number of UNIQUE numbers.
- Calling the function with the same parameter subsequent times will return the array of numbers in a new, random order.
- For example, calling
should return an array that contains 1000 unique numbers.$ generate(1000)
- Calling it again should return the same numbers in random order.
- Include
module.exports = generate;