CN1874357A - Method for generating id symbol - Google Patents

Method for generating id symbol Download PDF

Info

Publication number
CN1874357A
CN1874357A CN 200510112526 CN200510112526A CN1874357A CN 1874357 A CN1874357 A CN 1874357A CN 200510112526 CN200510112526 CN 200510112526 CN 200510112526 A CN200510112526 A CN 200510112526A CN 1874357 A CN1874357 A CN 1874357A
Authority
CN
China
Prior art keywords
interval
produce
produces
new
generation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200510112526
Other languages
Chinese (zh)
Other versions
CN100579133C (en
Inventor
李阳林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN200510112526A priority Critical patent/CN100579133C/en
Publication of CN1874357A publication Critical patent/CN1874357A/en
Application granted granted Critical
Publication of CN100579133C publication Critical patent/CN100579133C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The method comprises: a) setting a range of ID value, and in term of availability of ID, partitioning the interval of ID value; b) selects anyone ID in the partitioned ID interval as a newly-generated ID. The invention can be used to generate the ID that is unique and is randomly configurable.

Description

A kind of method that produces identifier
Technical field
The present invention relates to the identifier generating technique of the communications field, particularly a kind of method that produces identifier.
Background technology
In communication technical field, the application of identifier (ID) is very extensive.For example the card number of various cards such as phonecard, rechargeable card or bank card all is an ID, is used for card of unique identification; Videoconference access code, Web conference access code etc. also all are ID, are used for videoconference of unique identification or Web conference.Above-mentioned various ID should satisfy following requirement:
1, ID is the combination of numeral, and the user can be imported on communication terminal.
2, ID has uniqueness, and an ID can only identify an object, can not repeat with existing ID.
3, ID has randomness, and each ID that produces is without any rule, and whenever anyone can not pass through known ID, the ID that derives and make new advances and produce.
4, ID has the length configurability, and the user can be according to the length of being come configuration ID by the variation of sign number of objects.
In the prior art, the following dual mode of general using produces the ID that satisfies above-mentioned requirements: a kind of is to utilize every mode that also makes up at random; Another kind is to utilize the current time in system to stab the mode that makes up with random number.
Wherein, the principle of utilizing every mode that also makes up at random to produce ID is as follows: if produce the ID of a N position, then for each produces [0 respectively in the N position, 9] random number between is combined the ID that forms a N position with the random number that produces, and judges this ID that whether includes new generation among the existing ID then, if have, then new ID that produces of explanation and existing ID repetition need produce an ID once more, till the ID of new generation and existing ID do not repeat.
The principle that the mode of utilizing current time in system stamp and random number to make up produces ID is as follows: computer programming language can provide the method for obtaining the current time in system stamp and the random function that produces random number, the method of obtaining the current time in system stamp of utilizing computer programming language to provide is obtained the current time of system and is stabbed, utilize the random function of the generation random number that computer programming language provides to produce one one or several random number, then with the time stamp setting obtained in a high position, the random number that produces is arranged on low level, and the two is combined and forms an ID.
Here, the current time in system that the method for obtaining the current time in system stamp of utilizing computer programming language to provide is obtained stabs, generally be from 0: 0: 0 on the 1st January in 1970 till now a certain moment process the second number, this second number in computer, generally store with the integer number of 4 bytes.
For first kind of mode that produces ID, that though the ID that produces satisfies is all digital, unique, at random with the configurable requirement of length, but the quantity of existing ID is many more, the probability that has the ID that includes new generation among the ID is just big more, and the situation for the ID of new generation is included in existing ID regenerates ID again, so repeatedly, the efficient that produces ID is very low, can't satisfy some to producing the demanding occasion of efficient of ID.
For second kind of mode that produces ID, because in existing computer system, timestamp generally uses the integer number of nybble to represent, its length has reached 10 characters, if adding one one or several random number thereafter, the figure place that will cause producing ID is long, can not satisfy the user well according to the requirement that is come configuration ID length by the variation of sign number of objects.In addition, because the random number of utilizing random function to produce may repeat, if allow to produce a plurality of ID each second, then the ID of Chan Shenging just may repeat, so still need with first kind of mode that produces ID the same, judge whether the new ID that produces repeats, and can only produce an ID each second so the mode of second kind of generation ID has limited, and obviously can't satisfy the requirement that large-data operation is used.
Summary of the invention
In view of this, main purpose of the present invention is to provide the method for a kind of ID of generation, all digital, unique improve to produce to satisfy, at random with the configurable efficient that requires ID of length, and satisfy the requirement of large-data operation application.
For achieving the above object, the invention provides the method for a kind of ID of generation, may further comprise the steps:
The span of A, configuration ID is divided the interval of ID according to the availability of ID;
B, in any one interval of being divided, appoint and get an ID as the new ID that produces.
In the such scheme, the interval of dividing ID according to the availability of ID described in the steps A is: in the span of the ID of configuration according to all the ID of usefulness determine current all available ID, current all available ID are divided at least one continuous interval of ID value.
In the such scheme, described step B comprises:
B1, all intervals of being divided are numbered;
B2, utilize random function to produce a random number in the numbering number range, select numbering and the identical interval of random number that produces, judge the number of ID in the selected interval that is used to produce ID,, then get this ID as the new ID that produces if having only an ID in this interval; If more than one ID is arranged, then execution in step B3 in this interval;
B3, utilize random function to produce a random number in the ID number range in this interval, get ID corresponding in this interval as the new ID that produces with this random number.
In the such scheme, described ID need produce a plurality of, and this method further comprises: upgrade the interval of ID according to the availability of ID, appoint in any one interval after renewal and get an ID as the new ID that produces.
In the such scheme, select during the last ID of described generation to be used to produce in the interval of ID and have only an ID; The interval of described renewal ID is: delete this interval, and remaining interval is renumberd.
In the such scheme, selecting during the last ID of described generation to be used to produce in the interval of ID has more than one ID, and with a border ID of this interval ID as new generation; The interval of described renewal ID is: delete the border ID of the new ID of generation of conduct in this interval, upgrade this interval.
In the such scheme, selecting during the last ID of described generation to be used to produce in the interval of ID has more than one ID, and with a non-border ID of this interval ID as new generation; The interval of described renewal ID is: delete the non-border ID of the new ID of generation of conduct in this interval, this interval is divided into two intervals, and all intervals are renumberd.
Therefore, the method of this generation ID provided by the invention, span by configuration ID, divide the interval of ID according to the availability of ID, and utilize random function in any one interval of being divided, to appoint and get an ID as the new ID that produces, can produce satisfy all digital, unique, at random with the ID of the configurable requirement of length.
Utilizing the present invention, because the span of ID can be disposed according to actual needs by the user, set maximum and the minimum value of ID, is whole numerals and the configurable ID of length so can guarantee the ID that produces.When needs produce a plurality of ID,, make at every turn and all do not producing ID in the scope with ID, so can guarantee to produce the uniqueness of ID owing to all will upgrade the interval of ID behind each generation ID.Because the present invention utilizes random function to select to produce the interval of ID at random, and in this interval, utilize random function to select an ID at random as the ID that produces, so can guarantee to produce the randomness of ID to the full extent.Therefore, the present invention can produce satisfy all digital, unique, at random with the ID of the configurable requirement of length.
Owing to all do not producing ID in the scope with ID at every turn, guarantee that the ID that produces satisfies the uniqueness requirement, when producing ID, needn't judge whether the ID of generation can repeat, thus improved greatly produce satisfy all digital, unique, at random with the efficient of the configurable ID of requirement of length.
Since produce to satisfy all digital, unique, stab with the current time of computer system with the ID of the configurable requirement of length and have nothing to do at random, in the unit interval, can produce the ID that meets the demands in a large number, so can satisfy the requirement of large-data operation application.
Description of drawings
Fig. 1 produces the realization flow figure of ID overall technological scheme for the present invention;
Fig. 2 is the method flow diagram that produces ID in the one embodiment of the invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, by the following examples, and with reference to accompanying drawing, the present invention is described in more detail.
Core content of the present invention is: by the span of configuration ID, divide the interval of ID according to the availability of ID, and utilize random function in any one interval of being divided, to appoint and get an ID as the new ID that produces, can produce satisfy all digital, unique, at random with the ID of the configurable requirement of length.
As shown in Figure 1, Fig. 1 produces the realization flow figure of ID overall technological scheme for the present invention, and this method may further comprise the steps:
Step 101: the span of configuration ID, divide the interval of ID according to the availability of ID;
Step 102: in any one interval of being divided, appoint and get an ID as the new ID that produces.
In above-mentioned steps 101, the span of described configuration ID is that maximum and the minimum value that the user sets ID according to actual needs carried out.For example, if the user wishes that according to actual needs the length of ID is 5, the minimum value that then can set ID is 10000, and the maximum of setting ID is 99999, and the span of ID is configured to [10000,99999].
Described availability according to ID is divided the interval of ID, be in the span of the ID of configuration according to all the ID of usefulness determine current all available ID, current all available ID are divided at least one continuous interval of ID value.
For example, if the span of ID of configuration be [10000,99999], suppose in this span not the ID of usefulness, all ID are available ID, and it is [10000,99999] that then that all are available ID is divided into the continuous interval of ID value.Suppose that in this span 10010,11001,25001,33001,52002,68005 and 95608 are whole ID of usefulness, for the ID that guarantees to produce and the ID of usefulness do not repeat, the span [10000,99999] of ID is divided into [10000,10009], [10011,11000], [11002,25000], [25002,33000], [33002,52001], [52003,68004], the continuous interval of [68006,95607] and [95609,99999] several ID values.
In above-mentioned steps 102, the described ID that gets a new generation of ID conduct that appoints in any one interval of being divided comprises: earlier all intervals of being divided are numbered, utilize random function to produce an interior random number of numbering number range then, select numbering and the identical interval of random number that produces, judge the number of ID in this interval, if have only an ID in this interval, then get this ID as the new ID that produces; If more than one ID is arranged in this interval, then utilize random function to produce a random number in the ID number range in this interval, get ID corresponding in this interval as the new ID that produces with this random number.
Utilize the method for above-mentioned generation ID, can produce one satisfy all digital, unique, at random with the ID of the configurable requirement of length.Produce if desired a plurality of satisfy all digital, unique, at random with the ID of the configurable requirement of length, this method further comprises: upgrade the interval of ID according to the availability of ID, appoint in any one interval after renewal and get an ID as the new ID that produces.Wherein, described availability according to the ID interval that upgrades ID comprises following several situation:
If have only an ID in the interval that utilizes random function to select in situation 1 step 102, after then getting the ID of this ID as new generation, this ID just becomes the ID of usefulness, in order to guarantee when producing ID, not produce the ID that repeats with this ID next time, need this interval is directly deleted, and remaining interval renumberd, realize renewal to the ID interval.
If in the interval that utilizes random function to select in situation 2 steps 102 more than one ID is arranged, after then utilizing random function in this interval, to choose the ID of an ID arbitrarily as new generation, this ID that chooses just becomes the ID of usefulness, in order to guarantee when producing ID, not produce the ID that repeats with this ID next time, this ID deletion in the interval need be realized the renewal to the ID interval.Two kinds of situations are arranged again this moment:
If situation a in the interval of selecting with a border ID of interval as the new ID that produces, then directly delete in this interval as the border ID of new generation ID, can realize renewal to the ID interval;
If situation b in the interval of selecting with a non-border ID of interval ID as new generation, then delete in this interval as the non-border ID that newly produces ID, simultaneously this interval is divided into two intervals, and all intervals are renumberd.
For the method for this generation ID provided by the invention can more clearly be described,, and this is elaborated with reference to accompanying drawing below in conjunction with a specific embodiment.
As shown in Figure 2, Fig. 2 is the method flow diagram that produces ID in the one embodiment of the invention.Need in the present embodiment to produce a plurality of ID, suppose that the span of the ID that the user disposes according to actual needs is [0,2147483648], the ID of usefulness has been 3,5,6,7,12,14 and 55 in this span, and this method may further comprise the steps:
Step 201: for the ID that guarantees to produce and the ID of usefulness do not repeat, according to the span [0,2147483648] of ID of configuration, and the ID 3,5,6,7,12,14 and 55 of usefulness, span [0 with ID, 2147483648] be divided into [0,2], [4,4], [8,11], [13,13], the continuous interval of ID value such as [15,54], [56,2147483648].
Step 202: interval [0,2], [4,4], [8,11], [13,13], [15,54], [56 of dividing, 2147483648] are numbered, obtain table 1.
Numbering Beginning is interval Between the end zone
0 0 2
1 4 4
2 8 11
3 13 13
4 15 54
5 56 2147483648
Table 1
Step 203: utilize random function to produce an interior random number of numbering number range [0,5], the identical interval of random number of selecting numbering and producing.
Step 204: being used to of judge selecting produces the number of ID in the interval of ID, if having only an ID in the selected interval, then execution in step 205; If more than one ID is arranged in the selected interval, then execution in step 206.
Step 205: get the new ID that produces of ID conduct in this interval, the interval of updating form 1 described ID, execution in step 207 then.
For example, if the random number of utilizing random function to produce in the numbering number range [0,5] is 3, then select to be numbered 3 interval [13,13] as the interval that is used to produce ID, owing to have only an ID 13 in this interval, then with 13 ID as new generation; After producing this ID, directly deletion is numbered 3 interval, and remaining interval is renumberd, and the interval after the renewal is as shown in table 2.
Numbering Beginning is interval Between the end zone
0 0 2
1 4 4
2 8 11
3 15 54
4 56 2147483648
Table 2
Step 206: utilize random function to produce a random number in the ID number range in the selected interval, get ID corresponding in this interval, and upgrade the interval of ID as the new ID that produces with this random number.
For example, if utilize random function to produce numbering number range [0,5] Nei random number is 4, then select to be numbered 4 interval [15,54] for producing the interval of ID, owing in this interval 40 ID are arranged, then utilize random function to produce a random number in the ID number range [0,39] in this interval.
At this moment, if utilize random function to produce ID number range [0 in this interval, 39] Nei random number is 0, then will get in this interval the ID corresponding as the new ID that produces with this random number 0, here because the ID corresponding with this random number 0 is 15, promptly begin interval value 15+ random number 0=15, so with 15 ID as new generation; After producing this ID, delete the border ID 15 of the new ID of generation of conduct in this interval [15,54], upgrade this interval and be [16,54], the interval after the renewal is as shown in table 3.
Numbering Beginning is interval Between the end zone
0 0 2
1 4 4
2 8 11
3 13 13
4 16 54
5 56 2147483648
Table 3
If utilize random function to produce ID number range [0 in this interval, 39] Nei random number is 12, then will get in this interval the ID corresponding as the new ID that produces with this random number 12, here because the ID corresponding with this random number 12 is 27, promptly begin interval value 15+ random number 12=27, so with 27 ID as new generation; After producing this ID, delete in this interval [15,54] as the non-border ID 27 that newly produces ID, this interval [15,54] is divided into two intervals [15,26] and [28,54], and all intervals are renumberd, the interval after the renewal is as shown in table 4.
Numbering Beginning is interval Between the end zone
0 0 2
1 4 4
2 8 11
3 13 13
4 15 26
5 56 2147483648
6 28 54
Table 4
Step 207: in the interval of the ID after renewal, repeated execution of steps 203~206 produces the next ID that meets the demands, and so repeated multiple times can produce a plurality of ID that meet the demands.
Above-described specific embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (7)

1, a kind of method that produces identifier is characterized in that, may further comprise the steps:
The span of A, configuring identifier ID is divided the interval of ID according to the availability of ID;
B, in any one interval of being divided, appoint and get an ID as the new ID that produces.
2, method according to claim 1 is characterized in that, the interval that the availability according to ID described in the steps A is divided ID is:
In the span of ID of configuration according to all the ID of usefulness determine current all available ID, current all available ID are divided at least one continuous interval of ID value.
3, method according to claim 1 is characterized in that, described step B comprises:
B1, all intervals of being divided are numbered;
B2, utilize random function to produce a random number in the numbering number range, select numbering and the identical interval of random number that produces, judge the number of ID in the selected interval that is used to produce ID,, then get this ID as the new ID that produces if having only an ID in this interval; If more than one ID is arranged, then execution in step B3 in this interval;
B3, utilize random function to produce a random number in the ID number range in this interval, get ID corresponding in this interval as the new ID that produces with this random number.
4, method according to claim 3 is characterized in that, described ID need produce a plurality of, and this method further comprises:
Upgrade the interval of ID according to the availability of ID, appoint in any one interval after renewal and get an ID as the new ID that produces.
5, method according to claim 4 is characterized in that, selects during the last ID of described generation to be used to produce in the interval of ID and has only an ID;
The interval of described renewal ID is: delete this interval, and remaining interval is renumberd.
6, method according to claim 4 is characterized in that, selecting during the last ID of described generation to be used to produce in the interval of ID has more than one ID, and with a border ID of this interval ID as new generation;
The interval of described renewal ID is: delete the border ID of the new ID of generation of conduct in this interval, upgrade this interval.
7, method according to claim 4 is characterized in that, selecting during the last ID of described generation to be used to produce in the interval of ID has more than one ID, and with a non-border ID of this interval ID as new generation;
The interval of described renewal ID is: delete the non-border ID of the new ID of generation of conduct in this interval, this interval is divided into two intervals, and all intervals are renumberd.
CN200510112526A 2005-09-30 2005-09-30 Method for generating ID symbol Expired - Fee Related CN100579133C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200510112526A CN100579133C (en) 2005-09-30 2005-09-30 Method for generating ID symbol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200510112526A CN100579133C (en) 2005-09-30 2005-09-30 Method for generating ID symbol

Publications (2)

Publication Number Publication Date
CN1874357A true CN1874357A (en) 2006-12-06
CN100579133C CN100579133C (en) 2010-01-06

Family

ID=37484613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200510112526A Expired - Fee Related CN100579133C (en) 2005-09-30 2005-09-30 Method for generating ID symbol

Country Status (1)

Country Link
CN (1) CN100579133C (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102842052A (en) * 2012-08-14 2012-12-26 江苏恒安方信科技有限公司 Identity code generation method
CN102929967A (en) * 2012-10-12 2013-02-13 深圳市华阳信通科技发展有限公司 System and method of generating, storing and searching random number
CN103810557A (en) * 2012-11-15 2014-05-21 航天信息股份有限公司 Invoice verification code generation method and device
CN103838604B (en) * 2013-12-13 2017-01-11 广东星辉天拓互动娱乐有限公司 Method for generating distributed globally unique ID
CN106411955A (en) * 2016-12-01 2017-02-15 微鲸科技有限公司 Modulus m congruence class ring based account generation method
CN107767132A (en) * 2016-08-23 2018-03-06 百度在线网络技术(北京)有限公司 Method and apparatus for generating prepaid card password
CN109325015A (en) * 2018-08-31 2019-02-12 阿里巴巴集团控股有限公司 A kind of extracting method and device of the feature field of domain model
CN115002078A (en) * 2022-05-11 2022-09-02 北京奇艺世纪科技有限公司 ID generation method and device
CN117390610A (en) * 2023-12-13 2024-01-12 中国人民解放军国防科技大学 Identity identification generation method, system and device

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102842052B (en) * 2012-08-14 2015-10-21 江苏恒安方信科技有限公司 A kind of identity code generating method
CN102842052A (en) * 2012-08-14 2012-12-26 江苏恒安方信科技有限公司 Identity code generation method
CN102929967A (en) * 2012-10-12 2013-02-13 深圳市华阳信通科技发展有限公司 System and method of generating, storing and searching random number
CN102929967B (en) * 2012-10-12 2015-10-14 深圳市华阳信通科技发展有限公司 The system and method for magnanimity generating random number, storage and search
CN103810557A (en) * 2012-11-15 2014-05-21 航天信息股份有限公司 Invoice verification code generation method and device
CN103838604B (en) * 2013-12-13 2017-01-11 广东星辉天拓互动娱乐有限公司 Method for generating distributed globally unique ID
CN107767132B (en) * 2016-08-23 2022-01-14 百度在线网络技术(北京)有限公司 Method and device for generating rechargeable card password
CN107767132A (en) * 2016-08-23 2018-03-06 百度在线网络技术(北京)有限公司 Method and apparatus for generating prepaid card password
CN106411955A (en) * 2016-12-01 2017-02-15 微鲸科技有限公司 Modulus m congruence class ring based account generation method
CN106411955B (en) * 2016-12-01 2019-07-23 微鲸科技有限公司 A kind of account generation method based on mould m congruence class ring
CN109325015B (en) * 2018-08-31 2021-07-20 创新先进技术有限公司 Method and device for extracting characteristic field of domain model
CN109325015A (en) * 2018-08-31 2019-02-12 阿里巴巴集团控股有限公司 A kind of extracting method and device of the feature field of domain model
CN115002078A (en) * 2022-05-11 2022-09-02 北京奇艺世纪科技有限公司 ID generation method and device
CN115002078B (en) * 2022-05-11 2024-04-09 北京奇艺世纪科技有限公司 ID generation method and device
CN117390610A (en) * 2023-12-13 2024-01-12 中国人民解放军国防科技大学 Identity identification generation method, system and device

Also Published As

Publication number Publication date
CN100579133C (en) 2010-01-06

Similar Documents

Publication Publication Date Title
CN1874357A (en) Method for generating id symbol
CN108959386B (en) Distributed global unique ID generation method, device, equipment and storage medium
CN1262972C (en) Improved Huffman data compression method
CN100525450C (en) Method and device for realizing Hoffman decodeng
CN1555626A (en) Ovsf code system and methods
CN1928850A (en) Method and apparatus for compressing data based on digital dictionary picture-representing data
US10700934B2 (en) Communication control device, communication control method, and computer program product
CN1968212A (en) Hardware-based differentiated organization method in stream classification
CN1284805A (en) Method for dynamic allocation of channel code with different lengths in radio communication system
CN1567907A (en) A method for utilizing network address resource
CN1753402A (en) Method of using simple network management protocol to act multirariant block inquiry
CN101060337A (en) An optimized Huffman decoding method and device
CN101080094A (en) URNTI allocation method and its device
CN1866218A (en) Source management method for software system
CN107562762A (en) Data directory construction method and device
CN101466071B (en) Method and apparatus for distributing time frequency resource
CN1492359A (en) Automatic state machine searching and matching method of multiple key words
CN115865099B (en) Huffman coding-based multi-type data segment compression method and system
CN114756385B (en) Elastic distributed training method under deep learning scene
CN1145296C (en) Code distributing method for CDMA system
CN1571352A (en) Method for processing five-membered stream group in network equipment
CN1669288A (en) Method and system for determining conformance of a data key with rules by means of memory lookup
CN1533066A (en) Up demodulation method for different speed service
CN1905434A (en) Data synchronous method, wireless network controller configurating method and tool
CN1119887C (en) Automatic distribution method of session mark for network equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100106

Termination date: 20150930

EXPY Termination of patent right or utility model