how can we create 4 digit random number in c++

#include <iostream>
#include <cstdlib>
#include <ctime>

int main() {
    // Seed the random number generator with the current time
    std::srand(static_cast<unsigned int>(std::time(0)));

    // Generate a random number between 1000 and 9999
    int random_number = std::rand() % 9000 + 1000;

    // Output the random number
    std::cout << "Random 4-digit number: " << random_number << std::endl;

    return 0;
}