You are not logged in.
Pages: 1
Hey there! So I wanted to generate a 13 char random number but faced a bunch of errors.
here's the code:
Random rnd = new Random();
long ID = rnd.Next(1398350831807,1498350831807);
the errors:
Error 1 The best overloaded method match for 'System.Random.Next(int, int)' has some invalid arguments
Error 2 Argument 1: cannot convert from 'long' to 'int'
Error 3 Argument 2: cannot convert from 'long' to 'int'
Any help would be appreciated, I'm still a beginner and really need to do this.
Have a nice day!
I can think of many methods,
How about something like
long ID = (long) ( rnd.NextDouble() * ( 10000000000000 -1 ) );
I can think of many methods,
How about something like
long ID = (long) ( rnd.NextDouble() * ( 10000000000000 -1 ) );
Thanks for the reply! Actually I fixed it myself using:
long ID = (Int64)rnd.Next(1, 1000000) * (Int64)rnd.Next(1, 999);
May try your code later! Thanks.
Pages: 1