randomath

1.6.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i randomath

      Weekly Downloads

      0

      Version

      1.6.0

      License

      MIT

      Unpacked Size

      15.3 kB

      Total Files

      7

      Last publish

      Collaborators

      • s0ftik3