Question: For an application we are working on I need to generate sample credit card numbers which pass the Luhn algorithm but which are also unique, so we cannot use the sample credit card numbers.

We need to be able to generate around 300 card numbers at a time, and ideally i would be able to do this when generating my input data.

Many Thanks

Answer: 
Create random numbers, then calculate the checksum number.

You can find more information at [Wikipedia - Luhn](http://en.wikipedia.org/wiki/Luhn), both details about the algorithm and links to different implementations.
From what I see you just need to ensure that when running through the algorithm you get a result of 0 (mod 10). So you can pick any number of random digits (or sequential if you like) and just add one last digit which will ensure that the number is valid.