Using Manuel's idea:
\documentclass{article}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\randomstring}{}
{
\randomstring_make:
}
\NewDocumentCommand{\defrandomstring}{sm}
{
\IfBooleanTF{#1}{\cs_set:Npe}{\cs_new:Npe} #2 { \randomstring_make: }
}
\NewDocumentCommand{\setrandomstringlength}{m}
{
\int_set:Nn \l_randomstring_length_int { #1 }
}
\int_new:N \l_randomstring_length_int
\cs_new:Nn \randomstring_make:
{
\prg_replicate:nn { \int_rand:n { \l_randomstring_length_int } }
{
\int_to_alph:n { \int_rand:n { 26 } }
}
}
\ExplSyntaxOff
\setrandomstringlength{26}
\begin{document}
\randomstring
\randomstring
\randomstring
\defrandomstring{\foo}
\texttt{\meaning\foo}
\setrandomstringlength{4}
\randomstring
\randomstring
\defrandomstring*{\foo}
\texttt{\meaning\foo}
\end{document}
With \setrandomstringlenght we set the upper bound to the length of the strings. A random integer between 1 and this upper bound (inclusive) is chosen and as many letters are randomly generated using \int_to_alph:n { \int_rand:n { 26 } }.
With \defrandomstring we can store a random string in a macro. The variant \defrandomstring* doesn't check whether the macro is already defined (use with care).
This works with any engine.

See edit history for a previous version.
\ifcase). This process repeated n times gives you the desired string (where n is the length, determined in the first step). I'm not sure, but I think to generate a random number (with pdfTeX at least) there is\pdfuniformdeviatebut I don't know its syntax. – Manuel Nov 05 '14 at 15:04