生成唯一编号
问题描述:
我 INT32
数据类型的三个变量在C ++中。我想生成 C ++
三 INT32
数字组合的唯一编号。比如我有 INT iVal1
, INT iVal2
和 INT iVal3
。是否有任何的算法来做到这一点?
I have three variables of int32
data type in C++. I want to generate unique number for combination of three int32
numbers in C++
. For example I have int iVal1
, int iVal2
, and int iVal3
. Is there any algorithm to do this?
为了避免混乱的问题我会重组的问题。基本上我想生成三个整数一个唯一的编号,因为我要保存这个数字在地图一键检索数据。
In order to avoid confusion in question I will rephrase the question. Basically I want to generate a unique number with three integers because I want to store this number as a key in map to retrieve the data.
有什么建议?谢谢你。
答
您可以使用一个好的哈希函数。
You can use a good hash function.