This C++ project can generate the desired number of random mobile numbers that work in India only.
In C++, generating random numbers at a stretch leads to significant time and space complexity. To avoid these complexities, C++ has rand() function in its standard library, which can be used to generate a random number. Rand() can be used to create random numbers in the range of [0, RAND_MAX].
Initially, the main() function takes the values of 'count', which is an integer that holds the number of random numbers to be generated by the system. Then there is a feature where we can choose any number from 6 to 9 as the first digit of the random numbers. Then getrandomdigit() function is called 'count' number of times. Getrandomdigit() holds the rand() funtion. Srand() seeds the pseudo-random number generator used by rand().
The final outcome of the project delivers 'count' number of random mobile numbers.
Submitted by Sreekar Reddy Boyapally (bsreekar)
Download packets of source code on Coders Packet