473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Creating a unique identifier from 3 ints

Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.

Jul 24 '07 #1
8 2056
DaTurk,

I would treat the three integers as components of a larger, 96 bit
integer. Because there isn't an algorithm for generating higly-unique
96-bit integers (unlike GUIDs, which are 128 bits), I would suggest starting
at 0, and then incrementing by 1 every time you need a new value (across the
96 bits, which you will have to code yourself).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DaTurk" <mm******@hotmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.

Jul 24 '07 #2

"DaTurk" <mm******@hotmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.
What is the range of the three inputs? 32-bit signed?

What is the data type needed for the output? String? Numeric? Size
constraints?
Jul 24 '07 #3
why not just use the Guid object?
--
-iwdu15
Jul 24 '07 #4
For clarification, by 96-bit integer, I mean 96-bit unsigned integer.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OD**************@TK2MSFTNGP05.phx.gbl...
DaTurk,

I would treat the three integers as components of a larger, 96 bit
integer. Because there isn't an algorithm for generating higly-unique
96-bit integers (unlike GUIDs, which are 128 bits), I would suggest
starting at 0, and then incrementing by 1 every time you need a new value
(across the 96 bits, which you will have to code yourself).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DaTurk" <mm******@hotmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
>Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.


Jul 24 '07 #5

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OD**************@TK2MSFTNGP05.phx.gbl...
DaTurk,

I would treat the three integers as components of a larger, 96 bit
integer. Because there isn't an algorithm for generating higly-unique
96-bit integers (unlike GUIDs, which are 128 bits), I would suggest
starting at 0, and then incrementing by 1 every time you need a new value
(across the 96 bits, which you will have to code yourself).
Too bad C# doesn't support the obfusc... I mean succinct syntax for handling
carry when incrementing a compound integer:

++num1 || ++num2 || ++num3; // num3 is most significant
Jul 24 '07 #6
On Jul 24, 12:24 pm, DaTurk <mmagd...@hotmail.comwrote:
Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.
Your question seems a little vague. What are the 3 ints? Just *any*
3 ints? Perhaps a little more about what you are trying to accomplish
will suggest some viable alternatives.

Chris

Jul 24 '07 #7
The reason this seems vague is that you don't state whether you need to get
back to the three ints from the unique identifier. If this is the case,
there are several options. If it is not a requirement, then just return an
incrimented static counter.
"DaTurk" wrote:
Hi,

I was just curious how you would go about creating a unique identifier
with 3 ints.

Jul 25 '07 #8
On Jul 24, 10:06 pm, ModelBuilder
<ModelBuil...@discussions.microsoft.comwrote:
The reason this seems vague is that you don't state whether you need to get
back to the three ints from the unique identifier. If this is the case,
there are several options. If it is not a requirement, then just return an
incrimented static counter.

"DaTurk" wrote:
Hi,
I was just curious how you would go about creating a unique identifier
with 3 ints.- Hide quoted text -

- Show quoted text -
My apologies. I have three signed integers. 32 bit, c# integers.
They are part of a structure that I'm going to be storing, but it
takes looking at all three of them together to make sure that the
structures are not duplicated. SO I was thinking I could just "or"
them together, or something of the like to create one unique
identifer.

I was thinking you could make all three strings, then append them, end
to end, and then convert them back to an int. But, it could get
bigger then a 64 bit long, which is as big as I want to go.

Jul 30 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kilroy Programmer | last post by:
Is there a way to store a unique numeric identifier (say, for example, an int) into a TreeNode, so that when the TreeNode is checked (since CheckBoxes is enabled) the eventhandler AfterCheck() can...
7
by: Robin | last post by:
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web interface, Data Access Layer and Database. How do I implement business logic and class layers into this solution?
4
by: blee456 | last post by:
I have to create an attendance list for a meeting that will have attendees that are both on the committee and non member participants. My thinking is to create a form that has the member names...
9
by: crescent_au | last post by:
Hi everybody, I want to create dynamic breadcrumbs for a site I am developing. I just want to get some views about the algorithm of breadcrumbs. The way I look at it is the concept of parent/...
1
by: Danny Liberty | last post by:
I need some opionions on an issue here... Suppose I want to keep a collection of objects, each need to be uniquely identified by a number. This number has no meaning as long as it's unique, so it...
4
by: ba.hons | last post by:
Hello all, Was wondering if anyone could provide some info on what could be a possible solution to a problem am having. I have to generate a Unique Identifier in C# which I will use to assign...
2
by: Ken | last post by:
Hi, I have a form whose control source is a view from SQL server 2005 database. The view has a primary key that is a unique identifier field with keys generated by newid() function from SQL server...
13
by: mliptak | last post by:
I'm trying to implement logging in my application, so that each log message has its unique identifier, e.g. log(identifier, text) What I want to achieve is that the compiler screams if the log()...
12
by: udaypawar | last post by:
I am working on transactional website. I am storing transaction identifier (a unique id) in a cookie, so that I can display transaction history to user. Now a days modern browsers support...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
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...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.