https://github.com/nsardo/generate-random-password
Generate a random password consisting of upper and lowercase alpha-numeric characters and special characters with inputs for length, and percent chance of special characters occuring.
https://github.com/nsardo/generate-random-password
example-project node-module nodejs npm-package
Last synced: 29 days ago
JSON representation
Generate a random password consisting of upper and lowercase alpha-numeric characters and special characters with inputs for length, and percent chance of special characters occuring.
- Host: GitHub
- URL: https://github.com/nsardo/generate-random-password
- Owner: nsardo
- License: mit
- Created: 2017-04-24T17:42:46.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-24T18:34:34.000Z (over 8 years ago)
- Last Synced: 2025-02-14T05:05:38.954Z (over 1 year ago)
- Topics: example-project, node-module, nodejs, npm-package
- Language: JavaScript
- Homepage: https://nsardo.github.io/generate-random-password/
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# generate-random-password
## for Node / Npm and Client Side JS
[](https://badge.fury.io/js/generate-random-password)
Generate a random password consisting of upper and lowercase alpha-numeric characters and special characters with inputs for length, and percent chance of special characters occuring.
Special Characters are: ! # $ % & * + ? ~ @
Makes use of seedrandom.js by David Bau for random number generation.
*DEFAULT*:
- Return alpha-numeric characters, roughly 80% chance for each letter
- Return special characters, roughly 20% chance for each letter
generateRandomPassword( length [,special_chars_percent_chance] )
where LENGTH: is required, and the number of characters desired in the password
SPECIAL_CHARS_PERCENT_CHANCE: is optional, and if not included, defaults to 20 (for 20% chance)
NOTE for special_chars_percent_chance, desired percentage chance should be a WHOLE NUMBER, i.e. 25 for 25%
## usage:
```
npm i generate-random-password
```
...
```
let gpw = require( 'generate-random-password' );
// this will create a random password of length 8, and
// a 20% chance of special chars for each letter
let pw = gpw.generateRandomPassword( 8 );
```
OR
```
// this will create a random password of length 8, special characters
// having a 50% chance of showing up each letter
let pw = gpw.generateRandomPassword( 8, 50 );
```