https://github.com/deployable/base62-random
Generate random base62 strings in Javascript
https://github.com/deployable/base62-random
base62 crypto id javascript nodejs random
Last synced: 10 months ago
JSON representation
Generate random base62 strings in Javascript
- Host: GitHub
- URL: https://github.com/deployable/base62-random
- Owner: deployable
- License: other
- Created: 2017-09-11T02:02:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-18T08:59:08.000Z (about 8 years ago)
- Last Synced: 2025-03-25T06:22:48.295Z (11 months ago)
- Topics: base62, crypto, id, javascript, nodejs, random
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/base62-random
- Size: 33.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# base62-random
Generate random [base62 strings](https://helloacm.com/base62/) quickly with better
[statistical dispersion](https://en.wikipedia.org/wiki/Statistical_dispersion)
than `Math.random()` unless Math.random is all that's available.
Largely based on [`uuid-random`](https://github.com/jchook/uuid-random)
## Install
yarn add base62-random
npm install base62-random
## Example Usage
### Node
```javascript
var base62 = require('base62-random');
base62(12); // 'KsykHbcCzUSL'
```
### Browser
```html
base62(13); // 'BAhl1V1BfUmo3'
```
### Is base62 string?
```javascript
base62.test('5HXx8Eznu0'); // true
base62.test('P-f6cA4e'); // false
```
## License
MIT
## Links
- Based on [jchook/uuid-random](https://github.com/jchook/uuid-random)
- github [deployable/base62-random](https://github.com/deployable/base62-random)
- npm [base62-random](https://www.npmjs.com/package/base62-random)