# How to get numbers with distinct digits within some range?

I have a little program I'm working on for my project (a simple practice in school), part of the program is that it should receive input composed of an array of 7 digit (or less) numbers which should contain only distinct digits and of course process of generating those numbers is a bit too slow and it's a bit frustrating since it's not even a main function. I was able too speed things up by using parallel computing yet I wonder if there is any way other than trying to evaluate each consecutive sequence of numbers to determine if it contains any digit more than once?

I tried looking through internet for some similar problem or algorithm but found nothing helpful.

-
I am not sure I understand your spec and requirements, but see if this helps. stackoverflow.com/questions/1851716/… – Amzoti Nov 25 '12 at 18:45
Do you receive the numbers and have to check them for duplicate digits or do you generate the numbers given a minimum and maximum? If you write the question clearly, it helps make sure we are answering the right one. – Ross Millikan Nov 12 '14 at 19:07

To select a k digit number with distinct digits (of course k $\le$ n), fill an array A[10] with zeros. This represents the digits chosen, with 0 meaning not chosen. Set your generated number N = 0.