Skip to content

Instantly share code, notes, and snippets.

@tcdw
Created October 5, 2018 14:20
Show Gist options
  • Save tcdw/9a43eb263e02a5c489ccf8e5cd10d4d7 to your computer and use it in GitHub Desktop.
Save tcdw/9a43eb263e02a5c489ccf8e5cd10d4d7 to your computer and use it in GitHub Desktop.
生成密码(Node.js
const generatePassword = (length) => {
const data = [];
for (let i = 0; i < length; i += 1) {
data.push(Math.floor(Math.random() * 94) + 33);
}
return Buffer.from(data).toString('utf8');
};
module.exports = generatePassword;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment