QRandomGenerator was introduced in 5.10 and qrand has since been deprecated. QRandomGenerator::global() returns a global instance that has been securely seeded. QRandomGenerator provides methods that generate values within ranges, so taking a modulus of the result isn't necessary.