Not a trivial problem and involves threads.
In reply to Re: unique sequences by Anonymous Monk in thread unique sequences by Anonymous Monk