Random number of 36 digits in C # [closed]

-2

I want to get a number of 36 random digits in C #, use the Random but I could not make the number of digits only 36

Greetings and thanks

    
asked by AprendizProgrammer 20.03.2018 в 07:48
source

1 answer

3

It occurs to me that you could name them in a String variable if you want such a long number.

Random random = new Random();
String numero="";
for(int i=0;i<36;i++){
    numero +=  Convert.ToString(random.Next(0, 9));

}

This way you would have a random 36-digit number stored in a String variable. If what you want is to make calculations with the thing is complicated.

That I know the maximum value of Int64 according to microsof is 9.223.372.036.854.775.807

  

Microsoft Int64

     

Int32 microsoft

     

Integer limits

If you try to pass that number to a variable int it's basically going to give you

  

System.OverflowException: 'Value too large or too small for tipo de valor .'

    
answered by 20.03.2018 в 08:00