Any time you raise a new army you'll get a new generic leader with stats determined in advance for the country you play (i.e. Austria's generic leaders are all 0/2/2). The good leaders you sometimes get are historically determined (they are actual generals who fought for your country in the past) and you get them when they historically entered your country's service (i.e. Austria gets Tilly and Wallenstein around 1618, when they fought the Thirty Years Wars in the real world, France gets Turenne and Vauban during Louis XIV's time, etc.) regardless of whether you're at war or not. A list of the leaders your country will get and when can be found in your save file, try and time your wars for when your good leaders come on line.