Using QRandomGenerator, but keeping RAND_MAX is really only a half port. Please, use QRandomGenerator's convenient generation functions.