Skip to content

tanglink-url/random-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Random String Generator

Using the randString() function:

The randString(length, set) takes two parameters, LENGTH and SET.

LENGTH -> The desired length of the output string (INTEGER)

SET -> The desired characters that will compose the output string (STRING)


You can calculate the amount of unique strings that can be generated using this formula:

lenght of SET to the power of LENGTH


Example: If you function call looks like this: randString(5, "ABC")

The formula will be:

3 to the power of 5

As the length of SET is 3 and LENGTH is 5.

The amount of unique possible strings will be 243

The output strings will be 5 characters long and will contain only "A", "B" or "C"

Examples:

ABCBA
ABACB
ABCCB