@patrykbn/randomid-generator
v1.0.1
Published
Random ID Generator
Downloads
1
Readme
Random ID Generator
A simple, lightweight JavaScript function to generate random IDs of a specified length. This package is ideal for creating unique identifiers for use in various applications. Installation
You can install the package via npm:
bash
npm install random-id-generator
Usage
First, import the function into your project:
javascript
const randomID = require('random-id-generator');
Then, use the randomID function to generate an ID of your desired length:
javascript
const id = randomID(10); console.log(id); // Example output: 'aZ4b5C7dE2'
API randomID(idLength)
idLength: number - The length of the ID you want to generate.
Returns: A string containing a randomly generated ID of the specified length. Example
javascript
const randomID = require('random-id-generator');
// Generate a random ID of length 8 const id = randomID(8); console.log(id); // Example output: 'a9B3cD2e'
// Generate a random ID of length 16 const id16 = randomID(16); console.log(id16); // Example output: 'F2d1bZ6cT8e9Wq3G'
License
This project is licensed under the MIT License