I know it may be poorly put together, but it worksPHP Code:
private String GenerateRandomString(int Amount)
{
Random Rand = new Random();
String Data = "";
for (int Dat = 0; Dat < Amount; Dat++)
{
int number = 0;
number = Rand.Next(1, 6);
int Numbera = Rand.Next(1,9999) + Rand.Next(9999,100000);
switch (number)
{
case 1:
Data += "if (" + Rand.Next(1,99).ToString() + " > " + Rand.Next(1001,2000).ToString() + ") { } \r\n";
break;
case 2:
Data += "if (" + Rand.Next(1, 99).ToString() + " < " + Rand.Next(1001, 2000).ToString() + ") { } \r\n";
break;
case 3:
Data += "if (" + Rand.Next(1, 99).ToString() + " != " + Rand.Next(1001, 2000).ToString() + ") { } \r\n";
break;
case 4:
String Numberr = Rand.Next(1,9000).ToString();
Data += "for (int I" + Numberr + " = 0; I" + Numberr + " < 1;I" + Numberr + " ++) { } \r\n";
break;
case 5:
String BooleanName = Rand.Next(1, 3000).ToString();
Data += "Boolean xep" + BooleanName + " = false; \r\n";
break;
default:
Data += "String x" + Numbera + Rand.Next(1,4000) + " = " + (Char)34 + Rand.Next(1, 100).ToString() + (Char)34 + ";" + "\r\n";
break;
}
}
return Data;
}
private String GenerateStringVoidBol(int Amount)
{
String Data = "";
Random Rand = new Random();
for (int Dat = 0; Dat < Amount; Dat++)
{
int number = 0;
number = Rand.Next(2, 5);
switch (number)
{
case 2:
String VoidName = Rand.Next(1,9999).ToString();
Data += "private void g" + VoidName + "() { } \r\n";
break;
case 3:
String StringName = Rand.Next(9000,12000).ToString();
Data += "private String kl" + StringName + "(String " + "x" + Rand.Next(1, 300) + " ) { return null; } \r\n";
break;
case 4:
String BolName = Rand.Next(12000, 18000).ToString();
Data += "private Boolean loka" + BolName + " () { return false; }";
break;
default:
VoidName = Rand.Next(1, 9999).ToString();
Data += "private void x" + VoidName + "() { } \r\n";
break;
}
}
return Data;
}
Results 1 to 7 of 7
Thread: [C#] Generators
- 09 Jan. 2011 07:16pm #1
[C#] Generators
- 23 Mar. 2011 08:04pm #2
What does this generate.
- 24 Mar. 2011 03:33am #3
Lol @ so much un-needed coding.
PHP Code:public string Random_String(int Length)
{
Random random = new Random();
string characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890()*&^!@#$%_-=+{}[]|/?><.,~`'\"";
string rand = string.Empty;
for (int i = 0; i < Length; i++)
{
rand += characters[random.Next(0, characters.Count())];
}
return rand;
}
---------- Post added at 033 AM ---------- Previous post was at 032 AM ----------
A random string. kalsfkljlk#(@($EjmfasJoMomma
- 29 Mar. 2011 07:36pm #4
- 20 Jul. 2011 10:29pm #5
Or, generate random numbers between 0 and 255, then use ASCII tables to convert it to characters (char(xxx) in VB.net).
I apologize for gravedigging but I thought extend this conversation's horizons.
- 22 Jul. 2011 07:06pm #6
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 2.10
- 08 Aug. 2011 01:24am #7
Prove me some polymorphic code in C# <3
I'd love to see an example, havn't had a sturdy one yet.Shh, I'm watching My little pony.