get random numbers
b.randomInt(min, max) provides a random integers between
the min and max values.
- Min and max can be positive or negative.
- The values are inclusive. (e.g. 1, 6 mimics a dice roll).
b.randomFloat(min, max) does the same thing, but returns a float value.
html
<button data-s="getInt" data-r="getInt">Integer</button>
<button data-s="getFloat" data-r="getFloat">Float</button>
javascript
export const b = {};
export function getInt(_, __, el) {
el.innerHTML = b.randomInt(1, 100);
}
export function getFloat(_, __, el) {
el.innerHTML = b.randomFloat(1, 100);
}