rand

export const rand = ( min, max ) => ( undefined == max ) && ( Math.random() * min ) || ( Math.random() * (max - min) + min )

use

console.log( rand( 21 ) ) → 5.7997596952879595 console.log( rand( 69, 420 ) ) → 234.81427100362754

import

<script type='module'> import { rand } from 'mod/rand.js' </script>