How to generate a printed random alphanumeric code?

Hello,

I have an unusual request, I know that.
I’m writing a simple 1-page flyer of a product that I sell. I want to distribute it during an event/exhibition.

It would be fantastic if I could print a different random code (i.e. BX1A12 or something like that) for every different printed page (i.e. all the flyers does not have the same code printed on it).
This code could be used by the customer to get a discount.

Is there any way to get that? I think is not possible, but… maybe there is a way.

Thanks for any idea/suggestion.

Create a spreadsheet with a column of random strings according to whatever your needs are - then use the spreadsheet as a data source for a merge document which is your flyer with a field included for the random string.

Uh! Sounds interesting… It will be merged during printing? I mean… I will obtain a different random string for every printed page?

Do you really need it to be random? A very simple solution is to insert a field where you need the code with InsertFieldOther, choosing Type Time, Select Time [not Time(fixed)], Format Additional Formats [HH]MMSS. Of course, it is not very random, there is no check key but it is guaranteed to never be the same.

@robleyd’s solution has the drawback that if you print twice, you’ll get the same sequence the second time. It is superior to mine if you want to record the codes in case they are associated with different discounts and you want to make sure they are used only once.

EDIT

To get unique codes, you must print flyers one by one; do not set Number of copies higher than 1 otherwise the code will be the same on all copies. If you print manually during a single session, strike F9 between each print job to update field contents.

Alternatively, you can write a small shell script to loop over launch-flyer-with-LO/print/quit a certain number of time. Eventually insert a (random?) pause so that time changes between copies. This is most convenient for an overnight job.

I like the Time solution, of course I have to find a way to take note of generates timecodes. Now I have a lot of material/ideas to work with!