The interchange control number must be unique between a specific sender / receiver pair.
Generally this is handled as a counter which increments for each interchange. Sometimes a sender maintains a single counter used across all sender IDs and for all recipients, other times a separate counter for each sender ID / recipient ID pair. Occasionally they may maintain two counters for each pair separated by 500000 or so (eg. when different interchanges are generated by multiple systems - eg an outsourced warehouse, or following an upgrade to a new system if it's not practicable to retain each recipient's counter).
I've also seen an encoding of date and time used as the interchange control number when the sender is confident that there will never be more than one interchange for each recipient encoded within a second (or for any recipient within a millisecond).
In practice it's highly unusual for a repetition of the control number to cause a problem if they're separated by 3 months or more, and most schemes I've seen used will go for over a year before the counter rolls over. eg. taking the last 9 digits of a POSIX timestamp (to 100ths of a second) will guarantee no repetition for around 4 months (as long as there won't be more than one interchange to the same recipient in that first 100th of a second) and will probably make chances of a duplicate vanishingly small for many years. If you do it to 10ths of a second instead, you're guaranteed not to have a duplicate for over 3 years.
Are you solving the situation where your rigid customer is rejecting interchanges you're sending, or where they're sending control numbers which you're flagging as duplicates? The way I'd handle these situations are quite different (and also depend on how rigid your organisation is).
I have (once only thankfully) seen a customer insist that all interchange control numbers between a specific sender/receiver pair not only be unique but be sequential and that message control numbers within those interchanges must also be sequential and formatted as four digit numbers with leading zeroes, and always starting from 0001 in each interchange. None of those additional requirements are supported by EDIFACT standards, but it was in this customer's message implementation guides and they were big enough to insist that their suppliers comply.