UNPKG

@randplus/0to1

Version:

In theory, the random functions in this package can also output 1. This package is included in 'randplus'.

15 lines (13 loc) 281 B
/** * @function * Returns a number between 0 and 1. * @returns {number} Returns a number between 0 and 1. */ function random() { let result; do { result = Math.random() + Math.random(); } while (result > 1); return result; } module.exports = random;