mirror of https://github.com/jkjoy/sunpeiwen.git
10 lines
174 B
JavaScript
10 lines
174 B
JavaScript
|
|
||
|
var crypto = require('crypto');
|
||
|
|
||
|
var lim = Math.pow(2, 32) - 1;
|
||
|
|
||
|
module.exports = function random () {
|
||
|
return Math.abs(crypto.randomBytes(4)
|
||
|
.readInt32BE() / lim);
|
||
|
};
|