How to generate unique number of 12 digits?
Posted
by DanSogaard
on Stack Overflow
See other posts from Stack Overflow
or by DanSogaard
Published on 2010-03-18T04:50:49Z
Indexed on
2010/03/18
4:51 UTC
Read the original article
Hit count: 252
I'm working on an app that sends raw data to zebra printer and print out barcodes. And since every item has its own unique barcode, I need to define a variable that automatically generates unique number of 12 digits long.
see example:
printBar prnt = new printBar("123456789012");
Is there anyway to define a double variable and pass it to a function that return uniqely 12 digits number and pass it over again to the printBar class?. But how to make sure everytime you access it returns a unique value?.
I also thought of another way, since am using MS Access db, I can create a column of AutoNumber datatype and assign it to Random, but you don't get the exact 12 digits required, sometimes it generates a value of 10 digits sometimes more or less.
© Stack Overflow or respective owner