The below implementation is to generate random number from 1 to given limit. The below function produces behavior similar to srand() function.
Prerequisite : random header in C++ | Set 1(Generators)
- Program to generate random alphabets
- Generate a random permutation of 1 to N
- Generate a random permutation of elements from range [L, R] (Divide and Conquer)
- Generate a number such that the frequency of each digit is digit times the frequency in given number
- C++ Program for How to check if a given number is Fibonacci number?
- random header in C++ | Set 3 (Distributions)
- random header | Set 2 (Distributions)
- random header in C++ | Set 1(Generators)
- Random-access Iterators in C++
- std::generate in C++
- Generate all the binary strings of N bits
- Code to generate the map of India (with explanation)
- Program for n-th even number
- Generating Test Cases (generate() and generate_n() in C++)
- Program for Sum of the digits of a given number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.