• Home
Name Date Size #Lines LOC

..--

index.jsD12-May-2024241 118

licenseD12-May-20241.1 KiB2217

package.jsonD12-May-20241.7 KiB7675

readme.mdD12-May-20241.4 KiB5028

readme.md

1# crypto-random-string [![Build Status](https://travis-ci.org/sindresorhus/crypto-random-string.svg?branch=master)](https://travis-ci.org/sindresorhus/crypto-random-string)
2
3> Generate a [cryptographically strong](https://en.m.wikipedia.org/wiki/Strong_cryptography) random string
4
5Can be useful for creating an identifier, slug, salt, fixture, etc.
6
7
8## Install
9
10```
11$ npm install --save crypto-random-string
12```
13
14
15## Usage
16
17```js
18const cryptoRandomString = require('crypto-random-string');
19
20cryptoRandomString(10);
21//=> '2cf05d94db'
22```
23
24
25## API
26
27### cryptoRandomString(length)
28
29#### length
30
31Type: `number`
32
33Length of the returned string.
34
35
36## Related
37
38- [random-int](https://github.com/sindresorhus/random-int) - Generate a random integer
39- [random-float](https://github.com/sindresorhus/random-float) - Generate a random float
40- [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array
41- [random-boolean](https://github.com/arthurvr/random-boolean) - Get a random boolean
42- [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object
43- [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object
44- [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique
45
46
47## License
48
49MIT © [Sindre Sorhus](https://sindresorhus.com)
50