@afaanbilal/random-string

Generate random strings of any length with an optional prefix (non-crypto use only)

Usage no npm install needed!

<script type="module">
  import afaanbilalRandomString from 'https://cdn.skypack.dev/@afaanbilal/random-string';
</script>

README

@afaanbilal/random-string

Generate random strings of any length with an optional prefix (non-crypto use only)



Install

npm i -S @afaanbilal/random-string

Usage

var randomString = require('@afaanbilal/random-string')

var str = randomString()
// -> UEQ1QnzGOIDXDVOw

var str = randomString({
    length: 12, // Optional, default: 16
    prefix: 'ID_', // Optional, default: ''
    charset: '1234567890' // Optional, default: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' 
})
// -> ID_328174983571

License

MIT