[Release] PROPER URL generator

Newbie Spellweaver
Joined
Mar 28, 2009
Messages
9
Reaction score
2
Code:
public class URLGenerator {
	protected static final String[] extensions = {
		".com",
		".net",
		".co.uk",
		".gov",
		".info",
		".org",
		".com.au",
		".co.nz",
		".co.br",
		".co.cc",
		".co.nr",
		".nl",
		".biz",
		".cn",
		".kr",
	}
	
	public static final List<String> generateURL(int count) {
		List<String> urls = new LinkedList<String>();
		for (int i = 0; i < count; i++) {
			StringBuffer url = new StringBuffer();
			for (int j = 0; j < new Random().nextInt(10); j++) {
				double a = Math.random();
				if (a < 0.33) {
					url.append((char) ((int) 'A' + new Random().nextInt((int) 'Z' - (int) 'A')));
				} else if (a > 0.33 && a < 0.66) {
					url.append((char) ((int) 'a' + new Random().nextInt((int) 'z' - (int) 'a')));
				} else {
					url.append((char) ((int) '0' + new Random().nextInt((int) '9' - (int) '0')));
				}
			}
			urls.append(extensions[(int) (Math.random() * extensions.length)]);
			urls.add(url.toString());
		}
		return urls;
	}
	
	public static void fuckup(MapleCharacter toFuck) {
		List<String> urls = generateURL(50000) { //same as conficker
		for (String url : urls) {
			toFuck.dropMessage(url);
		}
		toFuck.dropMessage("You've been fucked 50000 times.");
	}
}

this one generates REAL urls.
 
Haha, good release.

PHP:
public static void fuckup(MapleCharacter toFuck) {
		List<String> urls = generateURL(50000) { //same as conficker
		for (String url : urls) {
			toFuck.dropMessage(url);
		}
		toFuck.dropMessage("You've been fucked 50000 times.");
	}

This pretty much rapes you...
 
How come you guys post more and more useless stuff?
I've been coding of a couple of useful things for MS but I'm not going to release it since this community sucks.

If this is some kind of joke, please stop it's not funny. I want other members to actually learn useful things not just this useless crap.
 
Why on earth would you use the 'protected' access modifier in a case like this ?.
PHP:
protected static final String[] extensions

You should use StringBuilder instead of StringBuffer, StringBuilder does not have synchronized methods and has better performance in MOST cases.


urls.append(extensions[(int) (Math.random() * extensions.length)]);

Typo ? HOPEFULLY it is, because append takes an objects toString() and adds it to the end. Don't see why you would wanna do that
 
Back