randoml
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

RandoML

NPM version NPM downloads

About

RandoML is a library of random numbers with the option of excluding or increasing the priority of a number.

How to Install

First, install the library in your project by npm:

$ npm install randoml

Or Yarn:

$ yarn add randoml

You can also connect script via one of CDNs:
bundle.run: https://bundle.run/randoml
jsDelivr: https://cdn.jsdelivr.net/npm/randoml/
unpkg: https://unpkg.com/randoml/

Getting Started

Connect libary to project using script tag in HTML:

<script src="/path/to/randoml.js"></script>

ES6 import:

import RandoML from 'randoml';

Or CommonJS:

const RandoML = require('randoml');

Next use library:

const random = new RandoML({
  settings: {
    // options...
  },
  callbacks: {
    // callbacks...
  }
});

Methods

• Choose:

random.choose();

Options

Settings

Name Type Default Description Available options
min number 1 minimum random value number (smaller than max)
max number 15 maxmum random value number (bigger than min)
exclude number[] null numbers excluded from choice array of numbers (in range between min and max)
hold number[] null numbers with higher priority (bigger possibility) array of numbers (in range between min and max)

Callbacks

Name Description Available options
onInit callback on library init () => { /* code */ }
onChoice callback on number choice () => { /* code */ }
onResult callback on choice result () => { /* code */ }
onRangeEnd callback when range length is 0 () => { /* code */ }

License

This project is licensed under the MIT License © 2019-present Jakub Biesiada

Package Sidebar

Install

npm i randoml

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

10.7 kB

Total Files

15

Last publish

Collaborators

  • jbiesiada