This expression will give you a random 4-character alphanumeric string:
base_convert(rand(round(36*36*36+1), round(36*36*36*36)), 10, 36)
For a longer string, just concatenate them together:
$randString = base_convert(rand(round(36*36*36+1), round(36*36*36*36)), 10, 36)
. base_convert(rand(round(36*36*36+1), round(36*36*36*36)), 10, 36);
(Or incorporate it into a function that will concatenate as many times as desired.)