Hello.
How can I generate some fixed length unique number (for example 6 character)
based on some number like 1, 2, .. 45, 46, 47 (Generally I will use unique
ID of the database record as base number)?
Thank you. 4 2943
David Dvali <da*********@hotmail.com> wrote: How can I generate some fixed length unique number (for example 6 character) based on some number like 1, 2, .. 45, 46, 47 (Generally I will use unique ID of the database record as base number)?
What's the scope of the required uniqueness? If you're limited to 6
digits, you're not going to be able to generate more than a million of
them, for instance...
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Yes I know. I don't need more.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... David Dvali <da*********@hotmail.com> wrote: How can I generate some fixed length unique number (for example 6 character) based on some number like 1, 2, .. 45, 46, 47 (Generally I will use unique ID of the database record as base number)?
What's the scope of the required uniqueness? If you're limited to 6 digits, you're not going to be able to generate more than a million of them, for instance...
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
David Dvali <da*********@hotmail.com> wrote: Yes I know. I don't need more.
Could you be a bit clearer? What's your actual situation? Why can't you
just use the unique ID of the database record as the number itself?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
I was thinking the same. Just left pad the number with zeros if for some
reason you needed a total of 6 digits for formatting or something.
--
William Stacey [MVP]
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... David Dvali <da*********@hotmail.com> wrote: Yes I know. I don't need more.
Could you be a bit clearer? What's your actual situation? Why can't you just use the unique ID of the database record as the number itself?
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: vishal |
last post by:
i want to generate a random number of a fixed length
so how can i do this ??
i know some function which returns a single random character at a time
but is there any built-in function which...
|
by: darin dimitrov |
last post by:
Hello,
I need help with an algoritm that given a set of "n" distinct
numbers will
generate all the possible permutations of fixed length "m" of these
numbers WITH repetitions (a total of n^m...
|
by: Chris Dunaway |
last post by:
I have a web service which is accessed by a windows forms application.
When the application submits a unit of work (a "job"), I want to return a
job receipt or tracking number back to the...
|
by: Tran Hong Quang |
last post by:
Hi,
I am new to C. How to generate an fixed-length string containing an random
digits? for example string of 5 characters, the value can be 03234 or 23423
or 02343
Thanks
Tran Hong Quang
|
by: Jim Michaels |
last post by:
I need to generate 2 random numbers in rapid sequence from either PHP or
mysql.
I have not been able to do either. I get the same number back several times
from PHP's mt_rand() and from mysql's...
|
by: Orchid |
last post by:
Hello,
I am looking to generate a unique ID field on MS. Access. The ID is
with 10 digits with the combination of 5 Letters from the 26 letters
and 5 Numbers from 1 to 9. The letters and numbers...
|
by: Ashish Khandelwal |
last post by:
As MSDN is not giving us guarantee upon uniqueness of Hash Code, so
could any one suggest me that how to generate a unique Hash Code for
same string always, and generate different-2 Hash Code...
|
by: =?Utf-8?B?VGFydW4=?= |
last post by:
Hi,
I have to generate a fixed length text file.I have a file formats like
fields details as well as its length and position.what actually i have to do
that i will get the data from the databas...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |