Mir ist langweilig. Und der Blog soll leben!

#include <cstdlib>
#include <ctime>
#include <string>
std::string randomstring(unsigned int len) {
	using namespace std;

	char rndstr[len+1];
	//long cast to avoid precision warnings on x64 systems
	static long seed = (long) (time(0) + &rndstr);

	srand(seed);
	for(unsigned int i=0; i<len; ++i) {
		switch(rand()%3) {
			case 0: rndstr[i] = rand() % 26+65; break;	//A-Z
			case 1: rndstr[i] = rand() % 9 +48; break;	//0-9
			case 2: rndstr[i] = rand() % 26+97; break;	//a-z
		}
		seed += (long) rndstr[i];
	}
	rndstr[len] = 0;
	return rndstr;
}

#include <iostream>
int main() {
	for(int i=1; i<=50; i++)
		std::cout<<i<<" - "<<randomstring(i)<<std::endl;
	return 0;
}