Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
const s = ((n) => {
const alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let s = "";
for (let i = 0; i < n; i += 1) {
s += alphanum[~~(Math.random() * alphanum.length)];
}
return s;
})(n);
String s = "";
Integer z[], i = 0;
char a[] = new char[62], c;
for (c = 'a'; c <= 'z'; ++c) a[i++] = c;
for (c = 'A'; c <= 'Z'; ++c) a[i++] = c;
for (c = '0'; c <= '9'; ++c) a[i++] = c;
z = new Integer[62];
for (i = 0; i < 62; ++i) z[i] = i;
shuffle(asList(z));
for (i = 0; i < n; ++i) s = s + a[z[i]];
function RandomString(Size: Integer): String;
const
Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
Len = Length(Chars);
var
i: Integer;
begin
Result := '';
SetLength(Result, Size);
for i := 1 to Size do
begin
Result[i] := Chars[Random(Len)+1];
end;
end;
my @chars = ('A'..'Z', 'a'..'z', '0'..'9');
my $s='';
$s .= $chars[int rand @chars] for 1..$n;