Number selecting method and device, electronic equipment and computer readable medium

By using a key-value structure to cache preset rules and the number of numbers in the number selection system, a query factor X is generated to randomly query numbers and update the total number of requested numbers, thus solving the problem of multiple users selecting numbers at the same time and improving the speed and accuracy of number selection.

CN115705336BActive Publication Date: 2026-06-09CHINA TELECOM CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2021-08-06
Publication Date
2026-06-09

Smart Images

  • Figure CN115705336B_ABST
    Figure CN115705336B_ABST
Patent Text Reader

Abstract

The method comprises the following steps: caching a preset rule and a number of numbers matched with the preset rule; when a number selection request is obtained, determining a total number of request numbers TN matched with a target request rule in the number selection request according to the cache; generating a query factor X according to the total number of request numbers TN and a preset number of query numbers N; taking N numbers after an Xth matched number of matched numbers matched with the target request rule in a database as query result numbers; when the total number of request numbers TN is updated according to the query factor X, a number SN of the query result numbers and a query times RT, the query factor X is determined again according to the updated total number of request numbers TN, so that updated query result numbers are obtained according to the determined query factor X. The technical scheme provided by the embodiment of the present disclosure can effectively improve the number selection speed and reduce the probability of selecting a repeated number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a number selection method, apparatus, electronic device, and computer-readable medium. Background Technology

[0002] With the rapid development of the internet, the number of telecommunications users is increasing daily, and self-service application for network access is becoming more and more common. During this process, users need to select a phone number. When there is high traffic, caching is generally used to improve query speed. However, because phone number resources are unique, only one user can successfully complete the application, which can lead to multiple users selecting the same number simultaneously.

[0003] Therefore, a new method, device, electronic device, and computer-readable medium for number selection is needed.

[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure. Summary of the Invention

[0005] In view of this, the present disclosure provides a number selection method, apparatus, electronic device, and computer-readable medium, which can effectively improve the number selection speed and reduce the probability of selecting duplicate numbers.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] According to a first aspect of the present disclosure, a number selection method is proposed, the method comprising: caching a preset rule and the number of numbers matching the preset rule according to a key-value structure; when a number selection request is obtained, determining the total number of requested numbers TN matching the target request rule in the number selection request based on the cache; generating a query factor X based on the total number of requested numbers TN and a preset number of query numbers N; taking the N matching numbers after the Xth matching number in the database that match the target request rule as query result numbers, and performing an incremental operation on the number of queries RT; when updating the total number of requested numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, redetermining the query factor X based on the updated total number of requested numbers TN, so as to obtain the updated query result numbers based on the redetermined query factor X.

[0008] In one exemplary embodiment of this disclosure, generating a query factor X based on the total number of requested numbers TN and the preset number of query numbers N includes: if TN-N > 0, generating a random number between 0 and TN-N as the query factor X; if TN-N ≤ 0, determining the value of the query factor X to be 0.

[0009] In one exemplary embodiment of this disclosure, updating the total number of requested numbers TN according to the query factor X, the number of query result numbers SN, and the number of queries RT includes: if the value of the query factor X is greater than 0, and the number of query result numbers SN is not equal to the preset number of query numbers N, and the number of queries RT is not equal to the preset number of queries RX, then the total number of requested numbers TN is updated according to the number of query result numbers SN and the query factor X.

[0010] In one exemplary embodiment of this disclosure, updating the total number of requested numbers TN based on the number of query result numbers SN and the query factor X includes: determining the updated total number of requested numbers TN based on the sum of the query factor X and the number of query result numbers SN.

[0011] In one exemplary embodiment of this disclosure, the method further includes: if the value of the query factor X is 0, or the number of query result numbers SN is equal to the preset number of query numbers N, or the number of queries RT is equal to the preset number of queries RX, then responding to the number selection request and returning the query result number.

[0012] In one exemplary embodiment of this disclosure, the method further includes: updating the number of numbers matching the target request rule in the cache according to the updated total number of request numbers TN.

[0013] In one exemplary embodiment of this disclosure, the method further includes: updating the number of numbers matched under each preset rule in the cache in real time according to the update cycle.

[0014] According to a second aspect of the present disclosure, a number selection device is provided, comprising: a number quantity caching module configured to cache a preset rule and the number of numbers matching the preset rule according to a key-value structure; a request receiving module configured to, upon receiving a number selection request, determine the total number of requested numbers TN matching the target request rule in the number selection request based on the cache; a query factor generation module configured to generate a query factor X based on the total number of requested numbers TN and a preset number of query numbers N; a number query module configured to take the N matching numbers after the Xth matching number in the database that match the target request rule as query result numbers, and perform an incremental operation on the number of queries RT; and a result updating module configured to, when updating the total number of requested numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, redetermine the query factor X based on the updated total number of requested numbers TN, so as to obtain the updated query result number based on the redetermined query factor X.

[0015] According to a third aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs; wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the number selection method described in any of the preceding claims.

[0016] According to a fourth aspect of the present disclosure, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the number selection method as described in any of the preceding claims.

[0017] According to certain embodiments of the number selection method, apparatus, electronic device, and computer-readable medium provided in this disclosure, the number selection speed can be improved by caching preset rules and the number of numbers matching the preset rules according to a key-value structure. When a number selection request is obtained, the total number of requested numbers TN matching the target request rule in the number selection request is determined according to the cache. A query factor X is generated based on the total number of requested numbers TN, which allows the query result numbers to be retrieved from the database using a random factor, reducing the situation where multiple users select the same number simultaneously. At the same time, the total number of requested numbers TN can be updated according to the query factor X, the number of query result numbers SN, and the number of queries RT, and the query results can be rematched according to the updated total number of requested numbers TN, so as to avoid the situation where multiple users select the same number simultaneously when the matching number in the database has been sold but is still returned as the query result number.

[0018] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this disclosure. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. The drawings described below are merely some embodiments of this disclosure, and those skilled in the art will be able to derive other drawings from these drawings without any inventive effort.

[0020] Figure 1 This is a system block diagram illustrating a number selection method and apparatus according to an exemplary embodiment.

[0021] Figure 2 This is a flowchart illustrating a number selection method according to an exemplary embodiment.

[0022] Figure 3 This is a flowchart illustrating a number selection method according to another exemplary embodiment.

[0023] Figure 4This is a block diagram illustrating a number selection device according to an exemplary embodiment.

[0024] Figure 5 The diagram schematically illustrates a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0025] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that the invention will be thorough and complete, and the concept of the exemplary embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.

[0026] The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention can be practiced by omitting one or more specific details, or other methods, components, apparatuses, steps, etc. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of the invention.

[0027] The accompanying drawings are merely illustrative of the invention; the same reference numerals denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0028] The flowchart shown in the accompanying drawings is merely illustrative and does not necessarily include all content and steps, nor does it require execution in the described order. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0029] The exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0030] Figure 1 This is a system block diagram illustrating a number selection method and apparatus according to an exemplary embodiment.

[0031] In system 100 of the number selection method and apparatus, server 105 can be a server that provides various services, such as a back-end management server that supports the number selection system operated by users using terminal devices 101, 102, and 103 via network 104 (for example only). The back-end management server can analyze and process the received number selection requests and other data, and feed back the processing results (such as query result numbers - for example only) to the terminal devices.

[0032] Server 105 may, for example, cache preset rules and the number of numbers matching the preset rules according to a key-value structure; when a number selection request is obtained, it determines the total number of request numbers TN that match the target request rule in the number selection request based on the cache; it generates a query factor X based on the total number of request numbers TN and the preset number of query numbers N; it selects N matching numbers from the Xth matching number in the database that match the target request rule as query result numbers, and performs an incremental operation on the number of queries RT; for example, when updating the total number of request numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, server 105 may redetermine the query factor X based on the updated total number of request numbers TN, so as to obtain the updated query result numbers based on the redetermined query factor X.

[0033] Server 105 can be a single physical server, or it can be composed of multiple servers. A portion of server 105 can serve as the number selection task submission system in this disclosure, used to obtain tasks that will execute number selection commands; and a portion of server 105 can also serve as the number selection system in this disclosure, used to cache preset rules and the number of numbers matching the preset rules according to a key-value structure; when a number selection request is obtained, the total number of requested numbers TN matching the target request rule in the number selection request is determined according to the cache; a query factor X is generated according to the total number of requested numbers TN and the preset number of query numbers N; N matching numbers are selected from the Xth matching number in the database that match the target request rule as query result numbers, and the query count RT is incremented; when the total number of requested numbers TN is updated according to the query factor X, the number of query result numbers SN, and the number of query counts RT, the query factor X is re-determined according to the updated total number of requested numbers TN, so as to obtain the updated query result numbers according to the re-determined query factor X.

[0034] Figure 2This is a flowchart illustrating a number selection method according to an exemplary embodiment. The number selection method provided in this disclosure can be executed by any electronic device with computing power, such as terminal devices 101, 102, 103 and / or server 105. In the following embodiments, the method is illustrated by example with a server executing the method, but this disclosure is not limited thereto. The number selection method provided in this disclosure may include steps S202 to S210.

[0035] like Figure 2 As shown, in step S202, the preset rules and the number of numbers matching the preset rules are cached according to the key-value structure.

[0036] In this embodiment, the preset rules can be a specific phone number's location, the last four digits of the number including the digit 'a', the last four digits including both 'a' and 'b', or a combination of two or more of these rules, where a = 0, 1, 2, ..., 9; b = 0, 1, 2, ..., 9. For example, matching can be performed in a database containing all phone numbers according to the preset rules, and the number of successfully matched numbers is determined as the number of numbers matching the preset rules. This step can be set to be executed periodically during off-peak hours, or it can be triggered when a new number is detected being imported into the database.

[0037] In an exemplary embodiment, the number of numbers matched under each preset rule in the cache can also be updated in real time according to the update cycle to avoid the number of numbers matched under each preset rule recorded in the cache being inconsistent with the actual number of numbers in the database.

[0038] This involves caching a key-value structure using preset rules as keys and the number of numbers matched by those rules as values, such as using a Redis or Memcached caching system. This disclosure does not impose any specific limitations on this approach. Furthermore, when generating keys based on preset rules, the preset rules can be encoded. This disclosure does not impose any specific restrictions on the encoding method used when generating keys from preset rules.

[0039] In step S204, when a number selection request is obtained, the total number of request numbers TN that match the target request rule in the number selection request is determined according to the cache.

[0040] In this embodiment of the disclosure, the number selection request is, for example, made by a user operating a terminal device (e.g., ...). Figure 1 The data is generated when reference numerals 101, 102, or 103 in the accompanying drawings, and sent to the execution entity (server 105) of this embodiment via a terminal device. For example, a target request rule that conforms to the user's number selection intention can be generated based on the user's operation of the terminal device, and a number selection request can be generated based on the target request rule.

[0041] Upon receiving a number selection request, the target request rule can be matched with the preset rules in the cache, and the value (i.e., the number of numbers) corresponding to the successfully matched preset rule can be used as the total number of requested numbers TN.

[0042] In step S206, a query factor X is generated based on the total number of requested numbers TN and the preset number of query numbers N.

[0043] In this embodiment of the disclosure, the preset number of query numbers N refers to the maximum number of query result numbers returned in response to the number selection request. Wherein, if TN-N > 0, a random number between 0 and TN-N can be generated as the query factor X; if TN-N ≤ 0, the value of the query factor X can be determined to be 1.

[0044] In step S208, the N matching numbers after the Xth matching number in the database that match the target request rule are taken as the query result numbers, and the query count RT is incremented.

[0045] In this embodiment, a search can be performed in the database according to the target request rules (where the search only searches for numbers in a saleable state, not numbers in a sold state), and the N matching numbers following the Xth matching number in the search results (i.e., all matching numbers) are used as the query result numbers in the search order. When TN-N is less than 0, the TN-N matching numbers following the Xth matching number in the search results are used as the query result numbers in the search order. The query count RT represents the number of times step S208 is executed. For example, RT can be initialized to 0, and after executing S208 once, RT can be incremented by one, RT = 1; and during the second execution of S208, RT can be incremented again, RT = 2, and so on.

[0046] In step S210, when updating the total number of requested numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, the query factor X is re-determined based on the updated total number of requested numbers TN, so as to obtain the updated query result numbers based on the re-determined query factor X.

[0047] In this embodiment of the disclosure, if the value of the query factor X is greater than 0, and the number of query result numbers SN is not equal to the preset number of query numbers N, and the number of queries RT is not equal to the preset number of queries RX, then the total number of requested numbers TN can be updated based on the number of query result numbers SN and the query factor X. For example, the updated total number of requested numbers TN can be determined based on the sum of the query factor X and the number of query result numbers SN. The number of numbers matching the target request rule in the cache can be updated based on the updated total number of requested numbers TN. The preset number of queries RX is a pre-set maximum number of queries.

[0048] Since the total number of requested numbers TN is obtained through caching, if a number in the database is sold after caching, the number of matching numbers in the database that match the target request rule will be less than the total number of requested numbers TN. In this case, by updating the total number of requested numbers TN and redetermining the query factor X based on the updated total number of requested numbers TN, the updated query result numbers can be obtained based on the redetermined query factor X, thus preventing multiple users from selecting the same number simultaneously.

[0049] This can be done by pre-sorting the numbers in the database. Alternatively, the query result numbers can be sorted after the updated numbers have been determined, for example, using the `shuffle` method in Java's `Collections` class.

[0050] According to the number selection method provided in this disclosure, by caching the preset rules and the number of numbers matching the preset rules according to a key-value structure, the number selection speed can be improved. When a number selection request is obtained, the total number of requested numbers TN matching the target request rule in the number selection request is determined according to the cache. A query factor X is generated based on the total number of requested numbers TN, which allows the query result numbers to be retrieved from the database using a random factor, reducing the situation where multiple users select the same number at the same time. At the same time, the total number of requested numbers TN can be updated according to the query factor X, the number of query result numbers SN, and the number of queries RT, and the query results can be rematched according to the updated total number of requested numbers TN, so as to avoid the situation where multiple users select the same number at the same time because the matching number in the database has been sold but is still returned as the query result number.

[0051] In an exemplary embodiment, in the above Figure 2The number selection method in this embodiment may further include the following steps: If the value of the query factor X is 0, or the number of query result numbers SN is equal to the preset number of query numbers N, or the number of queries RT is equal to the preset number of queries RX, then the query result number is returned in response to the number selection request. Wherein, if the value of the query factor X is 0, it means that the matching numbers satisfying the target request rule are less than or equal to the preset number of query numbers N. In this case, if the query result number is completely consistent with the original query result number after the update operation, there is no need to update the query result number. For example, if the number of query result numbers SN is equal to the preset number of query numbers N, it means that the total number of request numbers TN matched by the target request rule has not been sold within the time range from caching to obtaining the query result number from the database. In this case, the situation where multiple users simultaneously select the same number will not occur if the matching number in the database has already been sold but is still returned as the query result number. For example, if the number of queries RT is equal to the preset number of queries RX, then re-querying may delay the response time of the number selection request, resulting in a slow response. Therefore, in this case, the query result number can be returned directly to avoid a slow response.

[0052] Figure 3 This is a flowchart illustrating a number selection method according to another exemplary embodiment. The number selection method provided in this disclosure may include steps S300 to S306.

[0053] like Figure 3 As shown, in step S300, the preset number of query numbers (N) and the preset number of queries (RX) are set.

[0054] Step 301: Determine the number of numbers that match the preset rules and cache them in a key-value (KV) structure.

[0055] Step 302: Receive number selection request, which includes the target request rule.

[0056] Step 303: Determine the total number of request numbers (TN) from the cache according to the target request rules.

[0057] Step 304: Generate query factor X. Generate a random number (X) between 0 and TN-N. If TN-N≤0, then X is 0.

[0058] Step 305: Query the database for the N numbers following X to obtain the query result numbers.

[0059] Here, the N numbers following X refer to the N matching numbers in the database that match the target request rule, starting from the Xth matching number. This step can be similar to step S208, and will not be described again here.

[0060] Step 306: Based on the query result (SN), query factor (X), number of random queries (RT), and preset number of random queries (RX), determine whether to re-execute the generation of query factor X and query result number. If yes, proceed to step 307; otherwise, proceed to step 308.

[0061] Step 307: Update the number of request numbers corresponding to the target request rule. The updated number of request numbers TN = X + SN. After the update, proceed to step 304.

[0062] Step 308: Query the result numbers in random order and return them.

[0063] The preset number of query numbers in step 300 can be a fixed value or a dynamic parameter.

[0064] The preset rules in step 301 can be, for example, starting with a number segment, such as 133, 189, 153, etc.; or whether the last four digits contain 4; or certain special rules, such as ABCD, AAAA, AABB, etc.

[0065] In step 306, determining whether to re-execute the generation of query factor X and query result number based on the query result (SN), query factor (X), number of random queries already performed (RT), and preset number of random queries (RX) may include:

[0066] If X = 0, then no.

[0067] If SN = N, then no.

[0068] If RT = RX, then no.

[0069] In other cases, yes.

[0070] In step 307, updating the number of requested numbers TN in the cache can be done atomically. If the new number of requested numbers is less than the number of numbers in the cache, then the cache is updated. For example, there are 100 (TN) numbers. Each query retrieves 10 (N) numbers. On the first query, the query factor is 30 (X), the query result numbers are 10 (SN) numbers from the 31st to the 40th, and these 10 query result numbers are returned, ending the query.

[0071] However, when 2 out of those 100 numbers are sold, during a query with a query factor of 90 (X), the query result is from the 90th to the 100th number. But only 8 (SN) numbers are actually returned because 2 have already been sold. At this point, the number of requested numbers TN in the cache can be updated.

[0072] The number selection method provided in this embodiment first employs a random factor. When the amount of query data is large, calculating the total number of numbers takes a long time. By caching the total number of numbers and updating the cache based on the query results, the query time is reduced. Random number queries and disordered result sets reduce the probability of duplicate numbers. Dynamically updating the total number of numbers based on the query results avoids errors in returned query results caused by inconsistencies between the cached numbers and the actual numbers stored in the database.

[0073] It should be clearly understood that this disclosure describes how specific examples are formed and used, but the principles of this disclosure are not limited to any details of these examples. Rather, based on the teachings of this disclosure, these principles can be applied to many other embodiments.

[0074] Those skilled in the art will understand that all or part of the steps of the above embodiments are implemented as a computer program executed by a central processing unit (CPU). When the computer program is executed by the CPU, it performs the functions defined by the methods provided in this disclosure. The program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.

[0075] Furthermore, it should be noted that the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0076] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0077] Figure 4 This is a block diagram illustrating a number selection device according to an exemplary embodiment. (Refer to...) Figure 4 The number selection device 40 provided in this embodiment may include: a number quantity caching module 402, a request receiving module 404, a query factor generation module 406, a number query module 408, and a result update module 410.

[0078] In the number selection device 40, the number quantity caching module 402 can be configured to cache the preset rules and the number of numbers matching the preset rules according to the key-value structure.

[0079] The request receiving module 404 can be configured to determine the total number of requested numbers TN that match the target request rule in the number selection request based on the cache when a number selection request is received.

[0080] The query factor generation module 406 can be configured to generate a query factor X based on the total number of requested numbers TN and the preset number of query numbers N.

[0081] The number query module 408 can be configured to take the N matching numbers after the Xth matching number in the database that match the target request rule as the query result numbers, and perform an incremental operation on the number of queries RT.

[0082] The result update module 410 can be configured to, when updating the total number of requested numbers TN according to the query factor X, the number of query result numbers SN and the number of queries RT, redetermine the query factor X according to the updated total number of requested numbers TN, so as to obtain the updated query result numbers according to the redetermined query factor X.

[0083] According to the number selection device provided in this embodiment, the selection speed can be improved by caching preset rules and the number of numbers matching the preset rules according to a key-value structure. When a number selection request is obtained, the total number of requested numbers TN matching the target request rule in the number selection request is determined according to the cache. A query factor X is generated based on the total number of requested numbers TN, which can be used to query the query result numbers from the database in a random factor manner, reducing the situation where multiple users select the same number at the same time. At the same time, the total number of requested numbers TN can be updated according to the query factor X, the number of query result numbers SN, and the number of queries RT, and the query results can be rematched according to the updated total number of requested numbers TN, so as to avoid the situation where multiple users select the same number at the same time because the matching number in the database has been sold but is still returned as the query result number.

[0084] In an exemplary embodiment, the query factor generation module 406 may be configured to: if TN-N > 0, generate a random number between 0 and TN-N as the query factor X; if TN-N ≤ 0, determine that the value of the query factor X is 0.

[0085] In an exemplary embodiment, when the result update module 410 updates the total number of requested numbers TN according to the query factor X, the number of query result numbers SN and the number of queries RT, it can be configured as follows: if the value of the query factor X is greater than 0, and the number of query result numbers SN is not equal to the preset number of query numbers N, and the number of queries RT is not equal to the preset number of queries RX, then the total number of requested numbers TN is updated according to the number of query result numbers SN and the query factor X.

[0086] In an exemplary embodiment, when the result update module 410 updates the total number of requested numbers TN according to the number of query result numbers SN and the query factor X, it can be configured to determine the updated total number of requested numbers TN based on the sum of the query factor X and the number of query result numbers SN.

[0087] In an exemplary embodiment, the number selection device 40 may further include a result return module, which is configured to return the query result number in response to the number selection request if the value of the query factor X is 0, or the number of query result numbers SN is equal to the preset number of query numbers N, or the number of queries RT is equal to the preset number of queries RX.

[0088] In an exemplary embodiment, the number selection device 40 may further include a cache-triggered update module, which can be configured to update the number of numbers matching the target request rule in the cache according to the updated total number of requested numbers TN.

[0089] In an exemplary embodiment, the number selection device 40 may further include: a cache period update module, which updates the number of numbers matched under each preset rule in the cache in real time according to the update period.

[0090] The following reference Figure 5 To describe an electronic device 500 according to this embodiment of the present invention. Figure 5 The electronic device 500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0091] like Figure 5 As shown, the electronic device 500 is manifested in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, and a bus 530 connecting different system components (including storage unit 520 and processing unit 510).

[0092] The storage unit stores program code that can be executed by the processing unit 510, causing the processing unit 510 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 510 can perform, as follows: Figure 2 or Figure 3 The steps are shown in the figure.

[0093] Storage unit 520 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 5201 and / or cache memory 5202, and may further include a read-only memory (ROM) 5203.

[0094] Storage unit 520 may also include a program / utility 5204 having a set (at least one) program module 5205, such program module 5205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0095] Bus 530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0096] Electronic device 500 can also communicate with one or more external devices 600 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 500, and / or with any device that enables electronic device 500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 550. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 560. As shown, network adapter 560 communicates with other modules of electronic device 500 via bus 530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0097] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0098] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section of this specification.

[0099] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0100] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0101] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0102] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0103] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0104] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and concept of this disclosure are indicated by the claims.

Claims

1. A method for selecting numbers, characterized in that, include: The preset rules and the number of numbers matching the preset rules are cached according to the key-value structure; When a number selection request is received, the total number of requested numbers TN that match the target request rule in the number selection request is determined based on the cache. A query factor X is generated based on the total number of requested numbers TN and the preset number of query numbers N; The N matching numbers following the Xth matching number in the database that match the target request rule are used as the query result numbers, and the query count RT is incremented. When updating the total number of requested numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, the query factor X is re-determined based on the updated total number of requested numbers TN, so as to obtain the updated query result numbers based on the re-determined query factor X; The query result numbers are listed in random order; The process of updating the total number of requested numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT includes: if the value of the query factor X is greater than 0, and the number of query result numbers SN is not equal to the preset number of query numbers N, and the number of queries RT is not equal to the preset number of queries RX, then the total number of requested numbers TN is updated based on the number of query result numbers SN and the query factor X.

2. The method as described in claim 1, characterized in that, The query factor X is generated based on the total number of requested numbers TN and the preset number of query numbers N, including: If TN-N > 0, then generate a random number between 0 and TN-N as the query factor X; If TN-N≤0, then the value of the query factor X is determined to be 0.

3. The method as described in claim 1, characterized in that, The total number of requested numbers TN is updated based on the number of numbers SN in the query results and the query factor X, including: The total number of requested numbers, TN, is determined by the sum of the query factor X and the number of query result numbers, SN.

4. The method as described in claim 1, characterized in that, Also includes: If the value of the query factor X is 0, or the number of query result numbers SN is equal to the preset number of query numbers N, or the number of queries RT is equal to the preset number of queries RX, then the query result number is returned in response to the number selection request.

5. The method as described in claim 1, characterized in that, Also includes: The cached number of numbers matching the target request rule is updated based on the updated total number of request numbers (TN).

6. The method as described in claim 1, characterized in that, Also includes: The number of matching numbers under each preset rule in the cache is updated in real time according to the update cycle.

7. A number selection device, characterized in that, include: The number quantity caching module is configured to cache preset rules and the number of numbers matching the preset rules according to a key-value structure; The request receiving module is configured to determine the total number of requested numbers TN that match the target request rule in the number selection request based on the cache when a number selection request is received. The query factor generation module is configured to generate a query factor X based on the total number of requested numbers TN and the preset number of query numbers N. The number query module is configured to take the Nth matching number after the Xth matching number in the database that matches the target request rule as the query result number, and to perform an incremental operation on the number of queries RT; The result update module is configured to, when updating the total number of request numbers TN based on the query factor X, the number of query result numbers SN, and the number of queries RT, redetermine the query factor X based on the updated total number of request numbers TN, so as to obtain the updated query result numbers based on the redetermined query factor X; The query result numbers are listed in random order; The result update module is further configured to update the total number of requested numbers TN based on the number of query result numbers SN and the query factor X if the value of the query factor X is greater than 0, the number of query result numbers SN is not equal to the preset number of query numbers N, and the number of queries RT is not equal to the preset number of queries RX.

8. An electronic device, characterized in that, include: At least one processor; Storage device for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method as described in any one of claims 1-6.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.