You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

randomath

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

randomath

Random math examples of addition, subtraction, multiplication and division with fake answers and true ones.

1.6.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

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.

Keywords

math

FAQs

Package last updated on 01 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts