1.6.0 • Published 4 years ago

randomath v1.6.0

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

Randomath library

Just a simple JavaScript math library that creates random math examples of addition, subtraction, multiplication and division with fake answers and true ones.

Usage

const Randomath = require('randomath');
const math = new Randomath();

Methods

getRandomAdd(times) — returns a random addition example.

getRandomSubtract(times) — returns a random subtraction example.

getRandomMultiply(times) — returns a random multiplication example.

getRandomDivide(times) — returns a random division example.

getRandomCompare(times) — returns a random comparison example.

 

Output example of getRandomAdd method

[
  {
    example: '48 + 39',
    answers: [ 91, 87, 90 ],
    answer: 87,
    answerId: 1
  }
]

 

Default number of examples is one. You can change it by replacing times to the number of repeats you need. For example getRandomAdd(3) will return 3 addition examples.  

Each method returns an array of objects.

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago