Just generate a large random number and test it for being prime. You don't need Qt for that.