rand.js 374 B

123456789101112131415
  1. var random = require('./random');
  2. var MIN_INT = require('../number/MIN_INT');
  3. var MAX_INT = require('../number/MAX_INT');
  4. /**
  5. * Returns random number inside range
  6. */
  7. function rand(min, max){
  8. min = min == null? MIN_INT : min;
  9. max = max == null? MAX_INT : max;
  10. return min + (max - min) * random();
  11. }
  12. module.exports = rand;