Monday, January 4, 2016

Node.js javascript mt_rand 사용하기

npm install js_mt_rand
--
var express = require('express');
var mt = require('js_mt_rand');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
//  res.send('respond with a resource');
        var d = new Date();
        var n = d.getTime();
        mt.srand(n);
        var r = mt.rand();
        console.log('rand='+r);
        res.send(''+r);
});

module.exports = router;

No comments:

Post a Comment