random.js 464 B

123456789101112131415161718
  1. /**
  2. * Just a wrapper to Math.random. No methods inside mout/random should call
  3. * Math.random() directly so we can inject the pseudo-random number
  4. * generator if needed (ie. in case we need a seeded random or a better
  5. * algorithm than the native one)
  6. */
  7. function random(){
  8. return random.get();
  9. }
  10. // we expose the method so it can be swapped if needed
  11. random.get = Math.random;
  12. module.exports = random;