Skip to content

randoml-js/randoml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version NPM downloads NPM license Codecov Travis Bundle size

About

RandoML is a random number library with option to disable or increase number priority.

React Implementation

If you use React, you can install dedicated module with the implementation of the RandoML library!

How to Install

First, install the library in your project by npm:

$ npm install randoml

Or Yarn:

$ yarn add randoml

You can also connect the script via one of the CDNs:

Getting Started

Connect the library with the project using ES6 import:

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

ES6 import:

import RandoML from 'randoml';

Or CommonJS:

const RandoML = require('randoml');

Next use the library:

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

Methods

• Choose:

random.choose();

• Predict (Available Soon):

random.predict(/* trainings */, /* numbers */);

Options

Settings

Name Type Default Description Available options
min number 1 Minimum random value number (smaller than max)
max number 15 Maximum 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