Documentation / @andrew_l/toolkit / randomString
Function: randomString() ​
randomString(
length
):string
Generates a random string of the specified length using characters from a predefined set. The characters used in the generated string include lowercase letters (a-z) and digits (0-9).
Parameters ​
length ​
number
The length of the random string to generate. Must be a positive integer.
Returns ​
string
A random string of the specified length, composed of characters from 'a-z' and '0-9'.
Example ​
ts
randomString(8); // e.g. 'a1b2c3d4'
randomString(12); // e.g. '3f6g7h8i9j0k'
randomString(5); // e.g. '1a2b3'