simple-randstring
TypeScript icon, indicating that this package has built-in type declarations

1.1.9 • Public • Published

Image of travis-ci

simple-randstring

Create random strings fast

Usage:

import { randomString } from 'simple-randstring'
 
// Use Math.random() to create random strings, fast but not secure
// Default charset is [0-9a-zA-Z]
randomString(30)
 
// Use window.crypto( on the browser ) or crypto( on node ) to create random strings
// The speed is only half compare to Math.random() but it is more secure
// If window.crypto is not supported , it will fall back to use Math.random()
randomString(30, true)
import { randomString, setRandCharset } from 'simple-randstring'
 
// Define your own charset
setRandCharset('abcdefg()!@#$%')
 
// Return something like ')ag)(#fbe@!a%g%$g(b#'
randomString(20, true)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.9
    0
    • latest

Version History

Package Sidebar

Install

npm i simple-randstring

Weekly Downloads

0

Version

1.1.9

License

ISC

Last publish

Collaborators

  • kiwi.liu