Module Module1
Sub Main()
Dim KeyGen As RandomKeyGenerator
Dim NumKeys As Integer
Dim i_Keys As Integer
Dim RandomKey As String
''' MODIFY THIS TO GET MORE KEYS - LAITH - 27/07/2005 22:48:30 -
NumKeys = 20
KeyGen = New RandomKeyGenerator
KeyGen.KeyLetters = "abcdefghijklmnopqrstuvwxyz"
KeyGen.KeyNumbers = "0123456789"
KeyGen.KeyChars = 12
For i_Keys = 1 To NumKeys
RandomKey = KeyGen.Generate()
Console.WriteLine(RandomKey)
Next
Console.WriteLine("Press any key to exit...")
Console.Read()
End Sub
End Module
http://www.codeproject.com/KB/vb/RandomKey.aspx
Date :
2011-06-10 06:38:45
By :
webmaster
No. 2
Guest
Code (C#)
class Program
{
static Random C = new Random();
static void Main(string[] args)
{
for(int i=0; i<50; i++)
Console.WriteLine(GenString(25));
Console.ReadKey();
}
static String GenString(int numGen)
{
char[] myChar = {'0','1','2','3','4','5','6','7','8','9',
'a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t',
'u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J',
'T','S','R','Q','P','O','N','M','L','K',
'U','V','W','X','Y','Z',
};
string ret = "";
for (int i = 0; i < 25; i++)
ret += myChar[C.Next(0, myChar.Length)];
return ret;
}
}