I am web developer. I need to create a function to get the posible random number for given length of string. Please give the formula for that.
ex:-
1 digit = 10 (0,1,2,3,......9)
2 digit = (00,01,02,...11,12,13,...)
please help me ! Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The smallest possible value that uses $n$ decimal digits is zero (assuming you don’t allow negative numbers, which I assume you don’t) and the largest is $99\dots 9$, where there are $n$ $9$s. A shorter way of writing that number is $10^n – 1$, so your function should return a list of every number from $0$ to $10^n – 1$.
In many programming languages this is trivial to write:
In Python 2.7:
In R: