C++ generate 25 digit random number? -


How can I generate a 25 digit random number using the rand () Can I store in the form of a string? ?

  Using Namespace std; Int main (int argc, char ** argv) {srand (time (0)); Four arrivals [26] = {0}; For (int i = 0; i  

This code generates 25 random numbers each time the program is running.

Similarly, I need to generate a 25 digit number and store it in the array.

Announce an array of six-six characters. Generate a random value between zero and twenty-four (inclusive) in a loop between '0' and '9' , and add the array to the string terminator with the array Finish Now you have string with 25 random decimal numbers.


For the actual random number generation, I recommend that you look at the new C ++ 11, especially

combine it with the function, and you just do it Can do with some rows.


Comments