Nav apraksta

seed.js 271B

12345678910111213141516
  1. var now = require("./index")
  2. module.exports = seeded
  3. /* Returns a Date.now() like function that's in sync with
  4. the seed value
  5. */
  6. function seeded(seed) {
  7. var current = now()
  8. return time
  9. function time() {
  10. return seed + (now() - current)
  11. }
  12. }