VB.Net kodları
Public Shared Function getRandomKarakter(Optional length As Integer = 10) As String
Dim rnd As Random = New Random
Dim array As String() = New String(53) {"0", "2", "3", "4", "5", "6",
"8", "9", "a", "b", "c", "d",
"e", "f", "g", "h", "j", "k",
"m", "n", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y",
"z", "a", "b", "c", "d", "e",
"f", "g", "h", "j", "k", "p",
"m", "n", "p", "r", "s", "t",
"u", "v", "w", "x", "y", "z"}
Dim sb As New System.Text.StringBuilder()
Dim k As Integer = 0
For i As Integer = 0 To length - 1
k = k + 1
sb.Append(array(rnd.Next(0, 54)))
If k > 53 Then Exit For
Next
Return sb.ToString()
End FunctionC# kodları
public static string getRandomKarakter(int length = 10)
{
Random rnd = new Random();
string[] array = new string[54] {
"0",
"2",
"3",
"4",
"5",
"6",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"m",
"n",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"p",
"m",
"n",
"p",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
};
System.Text.StringBuilder sb = new System.Text.StringBuilder();
int k = 0;
for (int i = 0; i <= length - 1; i++) {
k = k + 1;
sb.Append(array(rnd.Next(0, 54)));
if (k > 53)
break; // TODO: might not be correct. Was : Exit For
}
return sb.ToString();
}