RandoML is a random number library with option to disable or increase number priority.
If you use React, you can install dedicated module with the implementation of the RandoML library!
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:
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...
},
});
• Choose:
random.choose();
• Predict (Available Soon):
random.predict(/* trainings */, /* numbers */);
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) |
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 */ } |
This project is licensed under the MIT License © 2019-present Jakub Biesiada