CN102929967A - System and method of generating, storing and searching random number - Google Patents

System and method of generating, storing and searching random number Download PDF

Info

Publication number
CN102929967A
CN102929967A CN2012103862608A CN201210386260A CN102929967A CN 102929967 A CN102929967 A CN 102929967A CN 2012103862608 A CN2012103862608 A CN 2012103862608A CN 201210386260 A CN201210386260 A CN 201210386260A CN 102929967 A CN102929967 A CN 102929967A
Authority
CN
China
Prior art keywords
random number
interval
storehouse
index
random
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
CN2012103862608A
Other languages
Chinese (zh)
Other versions
CN102929967B (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.)
SHENZHEN HUAYANG XINTONG TECHNOLOGY DEVELOPMENT CO LTD
Original Assignee
SHENZHEN HUAYANG XINTONG TECHNOLOGY DEVELOPMENT 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 SHENZHEN HUAYANG XINTONG TECHNOLOGY DEVELOPMENT CO LTD filed Critical SHENZHEN HUAYANG XINTONG TECHNOLOGY DEVELOPMENT CO LTD
Priority to CN201210386260.8A priority Critical patent/CN102929967B/en
Publication of CN102929967A publication Critical patent/CN102929967A/en
Application granted granted Critical
Publication of CN102929967B publication Critical patent/CN102929967B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a system and a method for generating, storing and searching a random number. The system comprises a number interval library S1, a standby random number library S2, a used index library S3 and a used random number library S4, wherein the number interval library S1 is used for generating and storing a number interval section of the random number; the standby random number library S2 is used for randomly obtaining and generating the random number from the number interval library; the used index library S3 is connected with the standby random number library, establishes an index of the used random number according to a number interval and is used for storing the used random number of one interval index into a corresponding independent used sub-sheet; and the used random number library S4 is connected with the standby random number library, is used for storing the used random number and is used for carrying out independent sub-sheet storage on the used random number according to random number index of the used index library. According to the system and the method, an algorithm of applying mass of the random numbers is optimized; and meanwhile, the realization method is simplified, the cost is extremely reduced, the performance is improved and different grades of data processing requirements can be met.

Description

The system and method that random number generates, stores and search for
Technical field
The present invention relates to data and process, relate in particular to a kind of generation of magnanimity random number, storage for fields such as information security, communication, digital interface and computing machines and the system and method for searching for.
Background technology
At present, a lot of data processing field all need to use random number, and these application are specifically related to the many aspects such as generation, storage and search of random number, such as information encryption, QQ number, online transaction Voucher Code, online game etc.
Random number is divided into true random number and pseudo random number, and true random number is the random number that analog physical model (as toss a coin) produces, and need to be transformed to random number to the physical process with random nature with the physical accidental generator.But shortcoming is can not produce and original identical random number, can not carry out rechecking to result of calculation, when needs produce the random number of magnanimity, and the physical model very complex that can become, and also very high for hardware requirement.Pseudo random number all is to generate by certain algorithm, and modal random number algorithm is to add congruence and multiplicative congruential method in the linear congruential method.But along with the growth of data volume, a large amount of pseudo random numbers that complicated algorithm generates can produce certain burden to CPU, and are same also very high for the requirement of hardware.
More than two kinds of methods, after random number reaches some levels, will produce the bottleneck of application for the aspects such as formation efficiency, storage and index of random number, will be difficult to solve simply and break through.
Summary of the invention
The objective of the invention is to solve above-mentioned problems of the prior art, propose the system and method that a kind of random number generates, stores and search for.
The random number that the present invention proposes generates, stores and the system of search comprises:
The interval storehouse S1 of number is for the number segment that generates and deposit random number;
Random number for subsequent use storehouse S2 obtains and generates random number at random from the interval storehouse of number;
Index of reference storehouse S3 contacts with random number for subsequent use storehouse, according to the interval index of having used random number of setting up of number, and being stored in during correspondence independently " used submeter " with random number an interval index;
Used random number storehouse S4, contacted with random number for subsequent use storehouse, be used for depositing the random number that all have been used, and will be have carried out independent submeter with random number according to the random number index in index of reference storehouse and deposit.
Described system also comprises and index of reference storehouse S3 and the recovery random number storehouse S5 that contacted with random number storehouse S4, is used for reclaiming no random number, and these random numbers are back to random number for subsequent use storehouse, waits until again and utilizes.
The present invention also proposes the method that a kind of random number generates, stores and search for, and comprises the steps:
Steps A. it is interval to generate number;
Step B. generates random number for subsequent use;
Step C. applies for random number;
Step D. searches for random number.
Described steps A comprises:
A1., the create-rule in number interval is set, comprises each burst length, the maximum quantity of segment, the minimum number of segment;
A2. generate in order the beginning number of a number segment;
A3. generate the end number in this interval according to beginning number and burst length;
The beginning number in an interval that A4. will generate and end number storage are in the interval storehouse S1 of number;
Whether the interval quantity of A5. judging number interval storehouse generation is enough, if not, then repeating step A2 is interval to steps A 4 continuation generation numbers;
If A6. reach setting value, it is interval then to finish to generate number.
Described step B comprises:
B1. from the interval storehouse of number, get at random an interval, comprise the beginning number in this interval and finish number;
B2. the beginning number from described interval generates all numbers to the order that finishes number;
B3. all numbers in described interval are carried out randomly orderedly, obtain the unordered number in an interval;
B4. delete the described interval of obtaining in the interval storehouse of number;
B5. all random numbers in described interval are deposited in the random number for subsequent use storehouse;
B6. judge that the random number in the random number for subsequent use storehouse can be no enough, if not enough repeating step B1 is to step B5, until random number reaches setting value in the standby database;
If B7. enough, then finish to generate random number for subsequent use, and the interval in the interval storehouse of automatic supplemental numbers.
Described step C comprises:
C1. application side applies for the random number of some;
C2. from random number for subsequent use storehouse, get randomly the random number of some;
C3. get a random number, search for index of reference storehouse, judge that this random number is whether in index of reference storehouse;
If C4. this random number has existed in the index of reference storehouse, then turn step C7, if this random number does not exist in the index of reference storehouse, then turn step 5;
C5. generate new index corresponding to random number, and store in the index of reference storehouse;
C6. the random number of taking out is stored in corresponding the using in the submeter of index;
C7. the random number of taking out is stored in the index corresponding " having used submeter ";
C8. will use application and random number binding and storage, use in order to search;
C9. judge whether to finish the application quantity of random number, if do not finish, then repeating step C3 is to step C8,
C10: if finish, then finish random number process, simultaneously, replenish the random amount in " random number for subsequent use storehouse ".
Described step D comprises:
D1. submit the random number that needs search to;
D2. search for index of reference storehouse;
D3. judge whether this random number is present in the index;
If D4. do not exist, represent that this random number does not exist;
If D5. exist, the interval correspondence of search index uses submeter in the random number storehouse;
D6. judge with whether existing in the submeter, if do not have, represent that this random number does not exist; If exist, return this random number information.
The present invention adopts the thought in layering, segmentation, minute storehouse, by constructing different system architecture modules and adopting different process steps to realize the generation of magnanimity random number, storage and search.The present invention has optimized the algorithm in the application of magnanimity random number, has also simplified the method that realizes simultaneously, has greatly reduced cost, has improved performance, can satisfy the requirement that different stage is used.
Description of drawings
Fig. 1 is structured flowchart of the present invention;
Fig. 2 is the interval process flow diagram that generates of number of the present invention;
Fig. 3 is the process flow diagram that random number for subsequent use of the present invention generates;
Fig. 4 is the process flow diagram that random number of the present invention is used application;
Fig. 5 is the process flow diagram of random number search of the present invention.
Embodiment
As shown in Figure 1, the random number that proposes of the present invention generates, the system of storage and search comprises: number interval storehouse S1, random number for subsequent use storehouse S2, index of reference storehouse S3, with random number storehouse S4, reclaim random number storehouse S5.Wherein:
The interval storehouse S1 of number is used for generating and depositing the number segment of random number, segment after the use is with invalid or deletion, each segment in the interval storehouse of number comprises and begins number and finish number, each segment comprises 1,000,000 random numbers at least, and available segment is at least 10 ten thousand in the interval storehouse of number;
Random number for subsequent use storehouse S2 is used for obtaining at random and to generate random number from the interval storehouse S1 of number, is used for preparing the directly random number of use, and guarantees in this storehouse at least 100 ten thousand random number, and can control as required random amount;
Index of reference storehouse S3 is according to the interval index of having used random number of setting up of number, the index of reference storehouse generates between index area corresponding to random number according to number is interval, comprise the beginning number between the index area and finish number, hold at the most 1,000,000 numbers between each index area, simultaneously each index correspondence has been used submeter with an independence in the random number storehouse, and all random numbers of correspondence all are placed on this and use in the submeter between index area.
Be used for depositing the random number that all have been used with random number storehouse S4, random number carried out independent submeter according to the random number index in index of reference storehouse deposit.
Reclaim random number storehouse S5 and be used for reclaiming no random number, and these random numbers are back to random number for subsequent use storehouse, wait until again and utilize.
The random number that the present invention proposes generates, stores and the method for search comprises the steps:
Steps A. it is interval to generate number;
Step B. generates random number for subsequent use;
Step C. applies for random number;
Step D. searches for random number.
Below in conjunction with the number of topping up (being random number), describe generation, storage and the searching method of random number of the present invention in detail.
Fig. 2 is the interval product process figure of random number.It is interval that at first execution in step A generates the number of prepaid mobile phone recharging number:
A1., the create-rule in prepaid mobile phone recharging number interval at first is set, comprises each burst length, the maximum quantity of segment, the minimum number of segment etc.;
A2. generate the beginning number of a number segment by incremental order;
A3. generate the end number in this interval according to beginning number and burst length;
A4. the number interval that generates is stored in the interval storehouse of number;
A5. judge whether the interval quantity that the interval storehouse of number generates reaches the max cap. of setting, if do not reach, then repeating step B2 is interval to step B4 continuation generation number;
If A6. reach, then finish to generate the interval operation of number.
Fig. 3 is random number product process figure for subsequent use.After generating the number interval, generate the random number for subsequent use of prepaid mobile phone recharging password according to step B:
B1. randomly draw a number interval from the interval storehouse of number, this number interval comprises the beginning number in this interval and finishes number;
B2. generate all according to the beginning number in this number interval to the order that finishes number and supplement password (random number) with money;
B3. all numbers in interval are carried out randomly orderedly, obtain the unordered password of supplementing with money in a number interval;
B4. owing to the number interval of taking out usefulness, the acquired number of deletion is interval from the interval storehouse of number, to guarantee to supplement with money the not repeated of password;
All unordered passwords of supplementing with money in this number interval that B5. will obtain are deposited in the random number for subsequent use storehouse;
B6. judge supplementing password quantity with money and whether reach setting value in the random number for subsequent use storehouse, as do not reach that repeating step B1 is to step B5, until supplement the maximal value that password quantity reaches setting in the standby database with money, for subsequent use to ensure enough random numbers;
B7. as reach, then finish to generate the password (random number) of supplementing with money for subsequent use, and automatically replenish the interval in " the interval storehouse of number ".
Fig. 4 is that random number is used application flow chart.Generated unordered supplement password with money after, beginning execution in step C supplements password with money to these and uses application:
C1. application side applies for the prepaid mobile phone recharging password (random number) of some;
C2. from ready random number for subsequent use storehouse just now, get randomly the prepaid mobile phone recharging password of respective numbers;
C3. get one of them prepaid mobile phone recharging password, search for index of reference storehouse, check whether this prepaid mobile phone recharging password has corresponding index;
If C4. the index of this prepaid mobile phone recharging password has existed in the index of reference storehouse, then turn step C7, as not existing, then turn step C5;
C5. generate new index corresponding to prepaid mobile phone recharging password (random number), the index rule is for to set up index by the random number interval, comprise the beginning number between an index area and finish number, each interval can hold 1,000,000 numbers, the corresponding random number submeter of each index " has been used submeter ", all random numbers in this submeter between the storage index area;
C6. create new index corresponding " having used submeter ";
C7. the prepaid mobile phone recharging password (random number) that takes out is stored in the index corresponding " having used submeter ";
C8. prepaid mobile phone recharging number and prepaid mobile phone recharging cryptographic binding are got up, use in order to search;
C9. judge whether to finish the application of prepaid mobile phone recharging password (random number), if do not have, then repeating step C3 if finish, then turns step 10 to step C7;
C10 finishes prepaid mobile phone recharging password (random number) and processes, and the random number of application is returned to application side, simultaneously, replenishes the random amount in " random number for subsequent use storehouse ".
Fig. 5 is the process flow diagram of random number search.When the user has bought rechargeable card of the cell—phone, when supplementing with money, execution in step D searches for random number:
D1. the user namely submits the random number that needs search to according to prompting input handset prepaid card password;
D2. search for index of reference storehouse according to prepaid mobile phone recharging clip pin (random number); Check that the prepaid mobile phone recharging clip pin is whether at the beginning number between the index area with finish between the number;
If D3. between the index area of search less than the correspondence of prepaid mobile phone recharging clip pin, represent that this prepaid mobile phone recharging clip pin does not exist, and return and supplement with money unsuccessfully; If search between corresponding index area, then turn step 5;
D5. corresponding " having used submeter " of search index;
D6. judge whether to exist, do not search prepaid mobile phone recharging clip pin (random number), represent that this prepaid mobile phone recharging clip pin does not exist;
If D8. prepaid mobile phone recharging clip pin (random number) exists, then and return relevant information, the prompting successful recharging is increased to the telephone expenses of supplementing with money on user's the mobile phone remaining sum account.
Method number randomness used in the present invention is high, is not easy to be cracked, and security intensity is large, simultaneously, also improves a lot for the efficient of produce random number, management, authentication.The present invention also is applicable to the applicable cases of other magnanimity random numbers.
Only in order to illustrate structure of the present invention, those of ordinary skill in the art can make various deformation and variation to above specific embodiment under design of the present invention, and these distortion and variation include within protection scope of the present invention.

Claims (9)

  1. A random number generate, the system of storage and search, it is characterized in that described system comprises:
    The interval storehouse S1 of number is for the number segment that generates and deposit random number;
    Random number for subsequent use storehouse S2 obtains and generates random number at random from the interval storehouse of number;
    Index of reference storehouse S3 contacts with random number for subsequent use storehouse, according to the interval index of having used random number of setting up of number, and being stored in during correspondence independently " used submeter " with random number an interval index;
    Used random number storehouse S4, contacted with random number for subsequent use storehouse, be used for depositing the random number that all have been used, and will be have carried out independent submeter with random number according to the random number index in index of reference storehouse and deposit.
  2. 2. the system as claimed in claim 1, it is characterized in that: described system also comprises and index of reference storehouse S3 and the recovery random number storehouse S5 that contacted with random number storehouse S4, be used for reclaiming no random number, and these random numbers are back to random number for subsequent use storehouse, wait until again and utilize.
  3. 3. random number as claimed in claim 1 system is characterized in that, each segment in the interval storehouse of described number comprises and begin number and finish number that each segment comprises 1,000,000 random numbers at least, and available segment is at least 10 ten thousand in the interval storehouse of number.
  4. 4. random number as claimed in claim 1 system, it is characterized in that: described index of reference storehouse generates between index area corresponding to random number according to number is interval, comprises the beginning number between the index area and finishes number, holds at the most 1,000,000 numbers between each index area.
  5. 5. the method that random number generates, stores and search for is characterized in that described method comprises the steps:
    Steps A. it is interval to generate number;
    Step B. generates random number for subsequent use;
    Step C. applies for random number;
    Step D. searches for random number.
  6. 6. method as claimed in claim 5 is characterized in that, described steps A comprises:
    A1., the create-rule in number interval is set, comprises each burst length, the maximum quantity of segment, the minimum number of segment;
    A2. generate in order the beginning number of a number segment;
    A3. generate the end number in this interval according to beginning number and burst length;
    The beginning number in an interval that A4. will generate and end number storage are in the interval storehouse S1 of number;
    Whether the interval quantity of A5. judging number interval storehouse generation is enough, if not, then repeating step A2 is interval to steps A 4 continuation generation numbers;
    If A6. reach setting value, it is interval then to finish to generate number.
  7. 7. method as claimed in claim 5 is characterized in that, described step B comprises:
    B1. from the interval storehouse of number, get at random an interval, comprise the beginning number in this interval and finish number;
    B2. the beginning number from described interval generates all numbers to the order that finishes number;
    B3. all numbers in described interval are carried out randomly orderedly, obtain the unordered number in an interval;
    B4. delete the described interval of obtaining in the interval storehouse of number;
    B5. all random numbers in described interval are deposited in the random number for subsequent use storehouse;
    B6. judge that the random number in the random number for subsequent use storehouse can be no enough, if not enough repeating step B1 is to step B5, until random number reaches setting value in the standby database;
    If B7. enough, then finish to generate random number for subsequent use, and the interval in the interval storehouse of automatic supplemental numbers.
  8. 8. method as claimed in claim 5 is characterized in that, described step C comprises:
    C1. application side applies for the random number of some;
    C2. from random number for subsequent use storehouse, get randomly the random number of some;
    C3. get a random number, search for index of reference storehouse, judge that this random number is whether in index of reference storehouse;
    If C4. this random number has existed in the index of reference storehouse, then turn step C7, if this random number does not exist in the index of reference storehouse, then turn step 5;
    C5. generate new index corresponding to random number, and store in the index of reference storehouse;
    C6. the random number of taking out is stored in corresponding the using in the submeter of index;
    C7. the random number of taking out is stored in the index corresponding " having used submeter ";
    C8. will use application and random number binding and storage, use in order to search;
    C9. judge whether to finish the application quantity of random number, if do not finish, then repeating step C3 is to step C8,
    C10: if finish, then finish random number process, simultaneously, replenish the random amount in " random number for subsequent use storehouse ".
  9. 9. random number generation as claimed in claim 5, storage and searching method is characterized in that, described step D comprises:
    D1. submit the random number that needs search to;
    D2. search for index of reference storehouse;
    D3. judge whether this random number is present in the index;
    If D4. do not exist, represent that this random number does not exist;
    If D5. exist, the interval correspondence of search index uses submeter in the random number storehouse;
    D6. judge with whether existing in the submeter, if do not have, represent that this random number does not exist; If exist, return this random number information.
CN201210386260.8A 2012-10-12 2012-10-12 The system and method for magnanimity generating random number, storage and search Expired - Fee Related CN102929967B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210386260.8A CN102929967B (en) 2012-10-12 2012-10-12 The system and method for magnanimity generating random number, storage and search

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210386260.8A CN102929967B (en) 2012-10-12 2012-10-12 The system and method for magnanimity generating random number, storage and search

Publications (2)

Publication Number Publication Date
CN102929967A true CN102929967A (en) 2013-02-13
CN102929967B CN102929967B (en) 2015-10-14

Family

ID=47644765

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210386260.8A Expired - Fee Related CN102929967B (en) 2012-10-12 2012-10-12 The system and method for magnanimity generating random number, storage and search

Country Status (1)

Country Link
CN (1) CN102929967B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463626A (en) * 2014-12-03 2015-03-25 携程计算机技术(上海)有限公司 Ticket number generation method, server and server cluster
CN108399266A (en) * 2018-03-23 2018-08-14 广州爱九游信息技术有限公司 Data pick-up method, apparatus, electronic equipment and computer readable storage medium
CN117390610A (en) * 2023-12-13 2024-01-12 中国人民解放军国防科技大学 Identity identification generation method, system and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050207574A1 (en) * 2004-03-19 2005-09-22 Pitz Jeanne K System and method for generating pseudorandom numbers
CN1874357A (en) * 2005-09-30 2006-12-06 华为技术有限公司 Method for generating id symbol
CN101344893A (en) * 2008-07-17 2009-01-14 中兴通讯股份有限公司 History data access method and apparatus
CN102318300A (en) * 2011-07-22 2012-01-11 华为技术有限公司 Direct current (DC) compensating method, DC compensator and baseband signal processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050207574A1 (en) * 2004-03-19 2005-09-22 Pitz Jeanne K System and method for generating pseudorandom numbers
CN1874357A (en) * 2005-09-30 2006-12-06 华为技术有限公司 Method for generating id symbol
CN101344893A (en) * 2008-07-17 2009-01-14 中兴通讯股份有限公司 History data access method and apparatus
CN102318300A (en) * 2011-07-22 2012-01-11 华为技术有限公司 Direct current (DC) compensating method, DC compensator and baseband signal processor

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463626A (en) * 2014-12-03 2015-03-25 携程计算机技术(上海)有限公司 Ticket number generation method, server and server cluster
CN104463626B (en) * 2014-12-03 2018-11-13 携程计算机技术(上海)有限公司 Certificate generation method, server and server cluster
CN108399266A (en) * 2018-03-23 2018-08-14 广州爱九游信息技术有限公司 Data pick-up method, apparatus, electronic equipment and computer readable storage medium
CN108399266B (en) * 2018-03-23 2022-01-07 阿里巴巴(中国)有限公司 Data extraction method and device, electronic equipment and computer readable storage medium
CN117390610A (en) * 2023-12-13 2024-01-12 中国人民解放军国防科技大学 Identity identification generation method, system and device

Also Published As

Publication number Publication date
CN102929967B (en) 2015-10-14

Similar Documents

Publication Publication Date Title
CN101350869B (en) Method and apparatus for removing repeat of telecom charging based on index and hash
CN103729764B (en) Data transferring method and system based on biological characteristic
CN107292701A (en) Order group technology and device
CN105893964A (en) Gesture-based signature authentication
CN102779304A (en) Processing method for gifted amount in electronic wallet and server
CN101984469A (en) Self-service card issuing and charging method for IC-card refueling system
CN107491965A (en) A kind of method for building up and device in biological characteristic storehouse
CN109711801A (en) A kind of Internetbank account checking method and device
CN102929967B (en) The system and method for magnanimity generating random number, storage and search
CN101329793A (en) Method and system for processing electric currency information
CN109544803A (en) Charging method and system based on Application on Voiceprint Recognition
CN109272400A (en) Method for processing resource and device
CN109086289A (en) A kind of media data processing method, client, medium and equipment
CN102609840A (en) Multi-application mobile payment system
CN202067348U (en) Electrical invoice management system
CN103957104A (en) Dynamic token anti-phishing method and device
CN113240401A (en) Bank business operation withdrawing method and device based on block chain and 5G message
CN109697224A (en) A kind of bill message treatment method, device and storage medium
CN107392745A (en) One kind accounting checking fragmentation of data processing method
CN203573402U (en) Intelligent financial terminal
CN208141444U (en) The storage and the transaction device of ideal money
CN205942884U (en) Automatic vending system of fingerprint identification
CN108846672A (en) Personalized address generating method, device, electronic equipment and storage medium
CN103310341A (en) Method and device for recharging value card based on NFC (Near Field Communication) cell phone
CN107464178A (en) A kind of shared bicycle statement of account method, server and statement of account system

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: 20151014

CF01 Termination of patent right due to non-payment of annual fee