0
$\begingroup$

I want to generate a random string consists of lower- upper-case letters and digits. In addition, the length of this string is variable ranging from 4 to 6. For example, the first word is 3rT6, the second is DGJeH, third is LLG5us.

What is the permutations formula to calculate it.

Is it correct to calculate it using the following:

w!(n-w)!/n!

W is the number of characters and n is the number of the character set,

thanks

$\endgroup$
1
0
$\begingroup$

If you are asking for the formula that counts the number of strings with $w=4$, $w=5$, and $w=6$ symbols from your lower-upper-digit set, it is just $$n^w,$$ since there are no additional restrictions. If you would like your word to have no repeated symbols, or no vowels together (for example), then the answer will be different.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.