Generating Random Numbers
Momodou Jarju
To keep it simple, the following can be used:
random.Next(100, 999);
But, the random number can be repeated. So, prior to conformation of the random number, it needs to be checked whether similar entry has been saved earlier or not. If there is one, it should again create a random number, until its unique. Then, it can be saved and exited.
Ideally you can not ensure by 3 digits. GUID can be good option but it will give unnecessary overhead. You can generate using employee name. or CurrentDatetime(if you increase size)
you can crate a seperate table with one field for auto generation of number and query this table to get the latest record and append the record to your DDMMYY-SS-Append here
Thank you.. I will appreciate that.
Hi Momodou Jarju I am in Hurry right now and will post my detailed answer on Saturday if possible. But it is really possible and can be done with generating GUID and then deciding which part of GUID to take depending on their probablity of being unique. I have to investigate which part of GUID is always supposed to be unique if any as it is 16 bit number i believe. But just to note it will be easier if you can increase the length of SSS to SSSS for using GUID in your Application. In fact GUID is favorite once we are generating Random Passwords too and also to generate SCAN numbers to check if it is SPAM or not.Thanks and RegardsPrasoon.
Actually that has nothing to do with MAC addresses. These users will not be using computers to be registered.This some Identification process in a community. this is how the process will work.. 1)An individual will come to the registration center 2) Give his bioinformation a) FullName, date of birth, address, etc... 3) then from the information given, the date of birth and the place of issue number the individual identification is generated.
Hi Momodou Jarju First of all it is bit difficult to say if anything is random in world.What we can maximum achieve is to have least probability of same type of combination getting occurred again.Now you have a certain way of getting your probability increased so that combination doesn't occur again.The answer of mine will be to introduce another factor called MAC address which is physical address of you network card.Also with MAC-address in combination with the harddisk serialnumber will increase the probablity of not getting the same number again.I will try to write a article based on combination s suggested by you and along with mine so that actual combination s remain highly improbable (though might happen) if the same user using same machine with same birthday and then how to introduce some other factor to make it concrete distinguishable.Give me some time.But nothing is Random in Programetic world.Thanks and RegardsPrasoon.
I am generating a number of the following sequence DDMMYY-RR-SSS where DDMMYY is the individual date of birth RR Place of issue SSS a randomly generated number to different the individual born on the same day and same place of issue. This number should be unique for all employees. the date of birth and the place of issue is on the employee registration form but how can i randomly generate the SSS and make sure that there are no duplication after generating. For example my birthday is 2301984 and my place of issue is 01 then my number should be in this format 230184-01-347 of course 347 will be randomly generated no other employee who was born on this date and same place of issue should never have this randomly generated number. This number will be stored in a field of the employee table. I am using MSSQL