Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9058765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:48:15+00:00 2026-06-16T14:48:15+00:00

One of my clients wants to use a unique code for his items (long

  • 0

One of my clients wants to use a unique code for his items (long story..) and he asked me for a solution. The code will consist in 4 parts in which the first one is the zip code where the item is sent from, the second one is the supplier registration number, the third number is the year when the item is sent and the last part is a three division alphanumeric unique character.

As you can see the first three parts are static fields which will never change for the same sender in the same year. So we can say that the last part is the identifier part for that year. This part is 3-division alpahnumeric which means starting from 000 and ending with ZZZ.

The problem is that my client, for some reasonable reasons, wants this part to be not sequential. For example this is not what he wants:

06450-05-2012-000

06450-05-2012-001

06450-05-2012-002

…

06450-05-2012-ZZY

06450-05-2012-ZZZ

The last part should produced randomly like:

06450-05-2012-A17

06450-05-2012-0BF

06450-05-2012-002

…

06450-05-2012-T7W

06450-05-2012-22C

But it should also non-repetitive. So once a possible id is generated the possibility should be discarded from the selection pool.

I am looking for an effective way to do this.

  1. If I only record selected possibilities and check a newly created one against them there is always a worst case possibility that it keeps producing already selected ones, especially near the end.
  2. If I create all possibilities at once and record them in a table or a file it may take a while after every item creation because it will lookup for a non-selected record. By the way 26 letters + 10 digits means 46.656 possible combinations, and there is a chance that there may be a 4th divison added which means 1.679.616 possible combinations.

Is there a more effective way you can suggest? I will use C# for coding and MS SQL for databese..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:48:16+00:00Added an answer on June 16, 2026 at 2:48 pm

    If it doesn’t have to be random, you could maybe simply choose a fixed but “unpredictable” addend which is relatively prime to 26 + 10 == 36 == 2²·3². This means, just choose a fixed addend divisible by neither 2 nor 3.

    Then keep adding this fixed number to your previous serial number every time you need a new serial number. This is to be done modulo 46656 (or 1679616) of course.

    Mathematics guarantees you won’t get the same number twice (before no more “free” numbers are left).

    As the addend, you could use const int addend = 26075 since it’s 5 modulo 6.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of my clients wants his new Rails application to look more like his
One of my clients asked me to integrate an open source CMS in her
I am setting up a SaaS application that multiple clients will use to enter
I'm trying to implement a system with two clients one of them sends a
I have a server that receives various xml messages from clients (one thread per
One of my clients needs to pull customer data from a web service periodically.
One of my clients has added a number of account numbers in one of
One of my clients uses Trend Micro InterScan Messaging Security to protect their internal
I wrote a simple CMS for one of my clients which does specifically what
I am working on an iOS application that will use RestKit 0.20 to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.