Image

Imagejdevelop wrote in Imagecpp 😊content

Generate random strings

Can anybody point me to some resource where I can learn about generating random strings for using as authentication keys?
#include "chatEngine.h"

std::string generateKey( int keySize )
{
	char initString[] = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM";
	std::string key = "";
	for ( int i = 0;i < keySize; i++ )
	{
		key += initString[ lrand48() % ( sizeof( initString ) / sizeof( char ) ) ];
	}
	return key;
}


I would like to use something much smarter than this quick stub I wrote.