Quick actions

cmd+k|ctrl+k

Navigation

Languages

randn

Snippet info

Language

Cpp

Visibility

public

Author

kaniaslan27

Created

2025-03-13T15:00:32.465068Z

Updated

2025-11-20T06:38:19.828643Z

#include <iostream>

int main(){
    int n, i, num;
    std::cout << "Write down the amount of time you want random numbers" << std::endl;
    std::cin >> n;
    std::cout << "Write down the amount of it can chose from" << std::endl;
    std::cin >> i;
    std::cout << "Okay here are the numbers that you asked for" << std::endl;
    srand(time(NULL));
    for(int n2 = n; n2 > 0; n2--){
        num =  rand()%i + 1;
        std::cout << num <<std::endl;
    }
}
INFO