hello..
i need to develop an application form which will be used nationwide.once user complete fill in the form,reference number will appear.So i need to create reference number,there is no specific digit required as long as it is unique number/combination.can anyone teach me how to create the reference number? is it same like to generate random number?

Well you have a couple ways to approach this. If all of the forms connect back to a central server then the server can hold on to the reference number and everytime a new form is open it would increment the number by one. This way every form has a unique number. If that cant be done then you need to look into using some sort of GUID algorithm. Here is a wiki on GUID.

Nathan is basically correct. GUID's (Globally Unique IDentifiers) are difficult - I know because I have written code that generates them that are used world-wide in manufacturing systems. The main difference between what I developed and others is that you can determine the class of an object from the GUID, and use that to create either a new instance of that class, or duplicate / recompose an instance (constructing a true, new duplicate from serialized data).

So, you either need an algorithm that can generate GUARANTEED unique numbers on any number of running systems, or (big bottleneck here) they have to get a new number from a "master" server. The main problem with that is what happens when the master dies, and another server has to take over? How do you keep them sync'd? Seems simple, but is NOT - and is a major problem in computer science.

thank you NathanOliver and rubberman..i'll try to understand the GUID first before decide to use it or do like what rubberman said,make algorithm that can generate it...thank you again..i'll try my best ^_^ ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.