Unsolved How to generate a random string from QStringlist
-
Hello
How do I generate a random string from qstrjnglist ?
Thank you
-
@Pumzye
Do you mean: pick a random string element from aQStringList
? Or...? -
Hi and welcome to the forums
What kind of random string ?
QStringList is a list of strings so what do you to do with list to get a random string? -
Hi and welcome to devnet,
Do you mean something like:
QStringList list{"a", "b", "c", "d"}; std::random_device rd; std::mt19937 g(rd()); std::shuffle(list.begin(), list.end(), g); QString randomString = list.join(""); qDebug() << "Random string:" << randomString;