Pseudo-random dictionary generation and distribution method and system based on index mapping
By using an index-mapping-based pseudo-random dictionary generation and distribution method, the high cost, low security, and consistency issues in the generation and distribution of numbers in existing technologies are solved. This method enables large-scale, unpredictable number generation and distribution, and is suitable for multi-instance deployment environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU MICRO MACRO TECH CO LTD
- Filing Date
- 2026-04-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies suffer from problems such as high runtime generation costs, poor security, difficulty in supporting ultra-large-scale number spaces, and poor distributed consistency when generating and distributing numbers.
A pseudo-random dictionary generation and distribution method based on index mapping is adopted. This method initializes the character dictionary, performs disorder processing, calculates the total combination space of strings, persists the index order, and generates unique target strings on demand during runtime.
It enables large-scale, non-repeating, and unpredictable string generation and distribution, reducing system overhead, improving generation efficiency, and ensuring global uniqueness and controllability in multi-instance deployment environments.
Smart Images

Figure CN122113847A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer software and information security technology, specifically relating to a method and system for generating and distributing pseudo-random dictionaries based on index mapping. Background Technology
[0002] There is a widespread need to generate numbers or identifiers in internet business systems, enterprise information systems, and IoT device management systems, such as coupon codes, activation codes, invitation codes, device serial numbers, and order numbers. These numbers are usually directly exposed to end users and have a long usage period, therefore requiring high levels of security and unpredictability.
[0003] In the prior art, common solutions include:
[0004] 1. Generate strings in real time based on a random function;
[0005] 2. Sequential numbering plus simple obfuscation;
[0006] 3. Randomly generate and rely on the database's unique index for deduplication.
[0007] The above solution is usable on a small scale, but in scenarios with huge numbering spaces, high concurrency, and many deployment nodes, it gradually reveals shortcomings in performance, storage, and security, mainly in the following aspects:
[0008] 1. High generation cost during runtime: Random generation and real-time verification of duplicates lead to an increasing collision probability as the number of generated systems increases, resulting in a non-linear decline in system performance.
[0009] 2. The generation rules are easy to predict: sequential numbering, reversible algorithms, or single-run random algorithms. Once a user has a number of valid numbers, they can deduce other valid numbers through trial and error, exhaustive search, and other methods.
[0010] 3. Difficulty in supporting ultra-large-scale numbering spaces: When the character dictionary and number of bits are large, the complete numbering space cannot be stored as a whole, and existing solutions lack a generation mechanism that can be paginated and rebuilt.
[0011] 4. Poor distributed consistency: When deploying multiple backends, it is difficult to guarantee global uniqueness and sequential consistency when relying on memory or local state.
[0012] Therefore, it is very important to design a string generation and distribution method that guarantees no repetition at the mathematical level, avoids speculation at the engineering level, and is suitable for distributed deployment. Summary of the Invention
[0013] This invention aims to overcome the problems of high runtime generation costs, poor security, difficulty in supporting ultra-large-scale numbering spaces, and poor distributed consistency in existing string generation and distribution methods. It provides an index-based pseudo-random dictionary generation and distribution method and system that can achieve large-scale, non-repeating, and unpredictable pseudo-random dictionary mapping generation and distribution, and ensures global uniqueness and controllability in multi-instance deployment environments through a persistence mechanism.
[0014] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0015] A pseudo-random dictionary generation and distribution method based on index mapping includes the following steps;
[0016] S1, obtain the character dictionary and the target string length, initialize the character dictionary, and obtain the initial character sequence for subsequent mapping;
[0017] S2, Randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships;
[0018] S3. Calculate the total possible string combination space based on the disordered character dictionary and the preset character repetition constraint conditions;
[0019] S4. Based on the total string combination space, the numerical index is mapped to the corresponding target string as needed using a pseudo-random dictionary mapping method.
[0020] S5. Group the numerical indexes to form multiple sequence number pools, randomly shuffle the index order within each sequence number pool, and persistently store the shuffled index sequence.
[0021] S6. During runtime, an actual index value is retrieved from the current sequence number pool according to the distribution cursor order, and the actual index value is converted into the final distributed string result and output based on the pseudo-random dictionary mapping method.
[0022] Preferably, in step S3, the preset character repetition constraint includes allowing character repetition or disallowing character repetition.
[0023] Preferably, in step S3, when the preset character repetition constraint condition allows character repetition, the total string combination space is N^L, where N is the size of the character dictionary and L is the length of the target string;
[0024] When the preset character repetition constraint condition allows character repetition, step 4, mapping the numerical index to the corresponding target string as needed, includes the following process:
[0025] The numerical index is treated as an N-ary number, and through successive modulo and integer division operations, the numerical index is converted into an N-ary numerical sequence of length L.
[0026] According to the disordered character dictionary, each digit of the N-ary numerical sequence is used as the index of the character dictionary, and the corresponding characters are mapped sequentially. The characters are then combined in the order of high digit first and low digit last to form the target string.
[0027] Preferably, in step S3, when the preset character repetition constraint condition is that character repetition is not allowed, the target string length L ≤ the character dictionary size N, and the total string combination space is the number of permutations P(N,L);
[0028] When the preset character repetition constraint condition is that character repetition is not allowed, step 4, which maps the numerical index to the corresponding target string as needed, includes the following process:
[0029] A working copy of the disordered character dictionary is constructed for dynamically removing selected characters;
[0030] From the highest to the lowest bit, based on the remaining number of characters and the remaining number of bits, the characters are determined bit by bit using the permutation index decomposition method, and the corresponding characters are removed from the working copy after each character is determined.
[0031] Combine the characters one by one to form the target string.
[0032] Preferably, in step 5, the method for randomly shuffling the index order within each sequence number pool is as follows:
[0033] The index set within each sequence number pool is randomly sorted independently, so that the physical storage order of the indexes within the same sequence number pool is independent of the logical order of their corresponding numerical values.
[0034] Preferably, in step 6, retrieving an actual index value from the current sequence number pool according to the distribution cursor order includes the following process:
[0035] If the index in the current sequence pool has not been exhausted, then read the corresponding out-of-order index value according to the cursor position and increment the cursor.
[0036] If the index in the current sequence number pool is exhausted, the next pre-generated and persisted sequence number pool will be automatically loaded, the dispatch cursor will be reset, and the value will continue to be retrieved.
[0037] Preferably, in step S6, the final distributed string result is one of the following: coupon code, activation code, invitation code, device serial number, or order number.
[0038] This invention also provides a pseudo-random dictionary generation and distribution system based on index mapping, comprising:
[0039] An initialization module is used to obtain the character dictionary and the length of the target string, initialize the character dictionary, and obtain an initial character sequence for subsequent mapping;
[0040] The dictionary disorder module is used to randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships;
[0041] The space calculation module is used to calculate the total space of possible string combinations based on the disordered character dictionary and the preset character repetition constraints.
[0042] The mapping module is used to map numerical indices to corresponding target strings as needed, based on the total string combination space, using a pseudo-random dictionary mapping method.
[0043] The sequence number pool management module is used to group numerical indexes into multiple sequence number pools, randomly shuffle the index order within each sequence number pool, and persistently store the shuffled index sequence.
[0044] The distribution module is used to retrieve an actual index value from the current sequence number pool according to the distribution cursor order during runtime, and convert the actual index value into the final distributed string result based on the pseudo-random dictionary mapping method and output it.
[0045] Compared with the prior art, the beneficial effects of this invention are: (1) This invention achieves the unique generation and secure distribution of large-scale strings without introducing runtime deduplication verification, significantly reducing system overhead, improving generation efficiency, and effectively preventing users from speculating on number generation rules through samples. It is suitable for business scenarios with high security and performance requirements; (2) The method of this invention does not directly generate random string results, but is based on the idea of number base conversion and permutation index model. Under the condition of a given character dictionary and target number of bits, the string generation problem is abstracted into a mapping relationship between numerical index and string results. In different constraint scenarios where character repetition is allowed or not allowed, this invention can achieve large-scale, non-repeating and unpredictable pseudo-random dictionary mapping generation and distribution, and ensure global uniqueness and controllability in multi-instance deployment environment through persistence mechanism. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating a pseudo-random dictionary generation and distribution method based on index mapping in this invention. Figure 2 This is a schematic diagram of the pseudo-random dictionary disordering process in this invention. Detailed Implementation
[0047] To more clearly illustrate the embodiments of the present invention, specific implementation methods will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.
[0048] like Figure 1 As shown, the present invention provides a data structure design method for process simulation scenarios, including the following steps;
[0049] 1. Obtain the character dictionary and the target string length, initialize the character dictionary, and obtain the initial character sequence for subsequent mapping;
[0050] 2. Randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships;
[0051] 3. Based on the disordered character dictionary and the preset character repetition constraints, calculate the total possible string combination space;
[0052] 4. Based on the total string combination space, the numerical index is mapped to the corresponding target string as needed using a pseudo-random dictionary mapping method;
[0053] 5. Group the numerical indexes into multiple index pools, randomly shuffle the index order within each index pool, and persistently store the shuffled index sequence.
[0054] 6. During runtime, an actual index value is retrieved from the current sequence number pool according to the distribution cursor order, and the actual index value is converted into the final distributed string result based on the pseudo-random dictionary mapping method and output.
[0055] Specifically, the process of initializing the character dictionary in step 1 is as follows:
[0056] Set an initial character sequence, for example:
[0057] Character dictionary D = [a, b, c].
[0058] Furthermore, step 2, the process includes the following specific steps:
[0059] Before the mapping begins, the character dictionary is randomly rearranged to obtain a disordered character dictionary D′, for example:
[0060] D′=[b,c,a].
[0061] like Figure 2As shown, the disordered character dictionary serves as the basis for subsequent mapping algorithms, and is used to disrupt the intuitive correspondence between characters and indices.
[0062] Furthermore, in step 3, the preset character repetition constraint includes allowing character repetition or disallowing character repetition. Correspondingly, in step 4, the pseudo-random dictionary mapping method is divided into a pseudo-random dictionary mapping method that allows character repetition or a pseudo-random dictionary mapping method that disallows character repetition.
[0063] The pseudo-random dictionary mapping method that allows character repetition is as follows:
[0064] When character repetition is allowed, set:
[0065] The character dictionary is N in size; the target string is L in length; and the total number of valid strings is N^L.
[0066] Where N represents the size of the character dictionary, L represents the length of the target string, and N^L represents the total number of strings that can be generated while allowing character repetition.
[0067] This method is based on the idea that "the number of characters is the number of bases". It treats the index as an N-ary number and maps it to characters bit by bit. Each valid string can be regarded as an N-ary number of length L.
[0068] Specific examples are as follows:
[0069] Given a character dictionary D′=[a,b,c] and L=3, the index-to-string mapping relationship is shown in the following example:
[0070] The index is 0, the corresponding mapping result is aaa; the index is 1, the corresponding mapping result is aab; the index is 2, the corresponding mapping result is aac; the index is 3, the corresponding mapping result is aba; and so on.
[0071] The above process defines a complete and continuous pseudo-random dictionary space.
[0072] In this scheme:
[0073] 1. View the character dictionary as a set of symbols in a number system;
[0074] 2. Treat numerical indices as N-ary integers;
[0075] 3. Determine each character by performing modulo and integer division operations;
[0076] 4. Combine the obtained characters into the target string.
[0077] This method guarantees a strict one-to-one mapping between the index and the string.
[0078] Additionally, the pseudo-random dictionary mapping method that does not allow duplicate characters is as follows:
[0079] To disallow duplicate characters, the following settings are made:
[0080] The character dictionary has a size of N;
[0081] The target string has a length of L, and L ≤ N;
[0082] The total number of valid strings is the number of permutations P(N,L).
[0083] This algorithm directly locates the index-th permutation result by decomposing the permutation index, where index represents the numerical index in the permutation space.
[0084] A specific example is as follows: Given a character dictionary D′=[a,b,c] and L=3, the permutation mapping relationship is as follows:
[0085] Index 0 corresponds to the mapping result abc; index 1 corresponds to the mapping result acb; index 2 corresponds to the mapping result bac; index 3 corresponds to the mapping result bca; index 4 corresponds to the mapping result cab; and index 5 corresponds to the mapping result cba.
[0086] The above mappings constitute an ordered but imperceptible pseudo-random dictionary.
[0087] This scheme uses a permutation index decomposition method:
[0088] 1. Build a working copy of the character dictionary for dynamically removing selected characters;
[0089] 2. Determine the character bit by bit from the most significant bit to the least significant bit;
[0090] 3. For each character, calculate the weight range based on the number of remaining characters and the number of remaining positions;
[0091] 4. Determine the current character using index division operations;
[0092] 5. Remove the selected characters and update the index value.
[0093] This method can directly locate the target string without generating all permutations.
[0094] Furthermore, step 5 includes the following process:
[0095] Sequence number pool group storage:
[0096] Because the pseudo-random dictionary can be extremely large, this invention employs a "serial number pool" approach for paging management. The "serial number pool" approach involves grouping consecutive numerical indexes according to a preset capacity, with each group forming a separate serial number pool. The serial number pool is used for paging control of the massive index space, thereby avoiding the need to store the entire index set at once.
[0097] For example, referring to the pseudo-random dictionary mapping method example that does not allow duplicate characters mentioned earlier, the permutation mapping relationship of the character dictionary D′=[a,b,c] and L=3, when the index values are 0, 1, and 2, the corresponding mapping results are abc, acb, and bac, respectively. Therefore, if the consecutive index values 0, 1, and 2 are managed as a sequence pool, the logically mapped string results obtained by this sequence pool are abc, acb, and bac, respectively.
[0098] Randomization within the sequence number pool:
[0099] To prevent predictability in the mapping results due to sequential index reading, the indexes within the sequence pool are randomly rearranged, for example:
[0100] Original sequence number pool index: [1,2,3].
[0101] The index of the scrambled sequence number pool is: [2,1,3].
[0102] Furthermore, step 6 includes the following process:
[0103] Ordered value retrieval and mapping:
[0104] When providing number distribution services, the system only exposes the sequential index used for value retrieval, not the actual numerical index. Through the indirect correspondence between the index and the index in the sequence pool, external users cannot infer the generation pattern of subsequent numbers based on the obtained numbers. For example:
[0105] Index 1 → Sequence Pool Index 2 → Mapping Result: acb;
[0106] Subscript 2 → Sequence Pool Index 1 → Mapping Result: abc.
[0107] When the sequence number pool is exhausted, the next sequence number pool is automatically generated, for example: [4,5,6], and the above disordering and distribution process is repeated.
[0108] The method of this invention is applicable to the following application scenarios:
[0109] Scenario 1: Generating coupon codes / activation codes
[0110] In this scenario, once the ID is guessed, it can be exhaustively searched by malicious scripts. This invention, through irreversible index mapping and a double random mechanism, prevents users from deducing the generation rules from known samples.
[0111] Scenario 2: Device Serial Number / Card Number
[0112] The serial number is usually completely exposed to the end user. The solution of this invention supports batch generation during the production period and secure distribution during the usage period, and can also be used for anti-counterfeiting verification.
[0113] Scenario 3: Invitation Code / Referral Code
[0114] By pre-generating a pseudo-random pool and distributing it sequentially, the risk of duplicate occupancy and number collisions under high concurrency is avoided.
[0115] In addition, the present invention also provides a pseudo-random dictionary generation and distribution system based on index mapping, comprising:
[0116] An initialization module is used to obtain the character dictionary and the length of the target string, initialize the character dictionary, and obtain an initial character sequence for subsequent mapping;
[0117] The dictionary disorder module is used to randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships;
[0118] The space calculation module is used to calculate the total space of possible string combinations based on the disordered character dictionary and the preset character repetition constraints.
[0119] The mapping module is used to map numerical indices to corresponding target strings as needed, based on the total string combination space, using a pseudo-random dictionary mapping method.
[0120] The sequence number pool management module is used to group numerical indexes into multiple sequence number pools, randomly shuffle the index order within each sequence number pool, and persistently store the shuffled index sequence.
[0121] The distribution module is used to retrieve an actual index value from the current sequence number pool according to the distribution cursor order during runtime, and convert the actual index value into the final distributed string result based on the pseudo-random dictionary mapping method and output it.
[0122] The following examples illustrate the specific implementation steps of this invention in practical applications:
[0123] This embodiment uses the generation and distribution of platform coupon numbers as an example for illustration, but the present invention is not limited to this application scenario.
[0124] I. Parameter Initialization
[0125] In this embodiment, the system is configured with the following parameters:
[0126] 1. The character dictionary consists of: AZ (26 uppercase letters) and 0-9 (10 digits), totaling 36 characters;
[0127] 2. The target coupon number length L is set to 8 digits;
[0128] 3. The capacity of each serial number pool is set to 1000;
[0129] 4. A pseudo-random dictionary mapping method that allows character repetition is adopted.
[0130] The size of the character dictionary is denoted as N=36; the length of the target number is denoted as L=8;
[0131] The total numbering space that can be theoretically generated is: N^L=36^8=2,821,109,907,456.
[0132] This combined space can meet the needs of generating large-scale coupons in bulk.
[0133] II. Character dictionary initialization and disorder handling
[0134] The system first initializes the input character dictionary to obtain an initial character sequence:
[0135] ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;
[0136] Subsequently, the system performs a one-time random rearrangement of the character dictionary based on a random seed, resulting in a scrambled character dictionary, for example:
[0137] Q7MZ1KX8A3TLP9C0WREY2U6BDVHS4FGJ5ON;
[0138] This scrambled character dictionary will serve as the basis for a fixed mapping throughout its subsequent lifetime.
[0139] III. Index Mapping Generation Mechanism
[0140] The system maintains a global numerical index, which increments from 0.
[0141] When a serial number needs to be generated, instead of directly generating a random string, it does not:
[0142] 1. Read the current numerical index;
[0143] 2. Using a pseudo-random dictionary mapping algorithm (based on N-ary conversion);
[0144] 3. Convert the index to N-ary representation;
[0145] 4. Select the corresponding character from the disordered character dictionary based on each value.
[0146] For example:
[0147] Assuming the current index is 12345,
[0148] The system converts 12345 into a base-36 numerical sequence.
[0149] Then, each character is mapped to the corresponding position in the disordered character dictionary.
[0150] Example of coupon code: QQQQQ3E5;
[0151] This process is a deterministic mapping process, where the same index always maps to a unique string within the same disordered character dictionary.
[0152] Detailed instructions on number system conversion:
[0153] Assume the current numerical index is index=12345, the character dictionary size is N=36, and the target string length is L=8.
[0154] The system first converts the index into an N-ary numerical sequence. Specifically, by performing modulo and integer division operations on the index, the value of the current digit is calculated by taking the index modulo N, and the index is updated to the integer part of the index divided by N. This process is repeated until an L-digit value is obtained. If the index is already 0 during the calculation, it is padded with 0s in the higher digits. The specific process is shown in Table 1 below: Table 1. Data table of number system conversion process for numerical index 12345.
[0155] Using the above method, the index can be represented as an N-ary numerical sequence of length L, with each digit ranging from [0, N-1].
[0156] Following the example above, the final hexadecimal digit sequence is:
[0157] (Low digit → High digit) is: [33,18,9,0,0,0,0,0];
[0158] After reversal (high position → low position): [0,0,0,0,0,9,18,33];
[0159] Subsequently, the system uses each digit of the N-ary numerical sequence as an index in the character dictionary according to the disordered character dictionary, maps them sequentially to obtain the corresponding characters, and combines them in the order of high digit first and low digit last to form the final string result: QQQQQ3E5.
[0160] This number system mapping method ensures that each numerical index can be uniquely and definitively mapped to a string of fixed length, and the string results corresponding to different indices are all different.
[0161] IV. Serial Number Pool Pagination Management Mechanism
[0162] Since the overall numbering space is extremely large, storing all indexes at once would result in excessive storage pressure. Therefore, this embodiment adopts a "serial number pool" paging mechanism for management.
[0163] The specific process is as follows:
[0164] 1. The system groups by consecutive index values, for example:
[0165] a) First sequence number pool: 0–999;
[0166] b) Second sequence number pool: 1000–1999;
[0167] c) And so on
[0168] 2. Within each sequence number pool, the index set is randomly shuffled.
[0169] For example:
[0170] The original order of the first sequence pool is:
[0171] 0,1,2,3,4,5,...,999;
[0172] The result after scrambling might be:
[0173] 128,5,873,42,999,3,...;
[0174] The system persistently stores the out-of-order index sequence in the database.
[0175] V. External Distribution Mechanism
[0176] When an external system requests the generation of a coupon number:
[0177] 1. The system reads the current dispatch cursor value;
[0178] 2. Position the cursor to the corresponding number in the pool;
[0179] 3. Obtain the actual index value corresponding to this position;
[0180] 4. Execute a pseudo-random dictionary mapping algorithm based on this index value;
[0181] 5. Output the final coupon number.
[0182] For example: the current distribution index is 1;
[0183] The first index value in the sequence pool is 128;
[0184] Map 128 to generate the string: Q7M8T1AX.
[0185] The string will then be returned as the coupon number.
[0186] External systems can only see the "sequentially distributed numbering results" and cannot infer the internal indexing patterns.
[0187] The method of the present invention has the following safety advantages:
[0188] 1. The numbering is not generated by a traditional random function, but by a deterministic mapping based on numerical indices;
[0189] 2. After the character dictionary is scrambled, the mapping pattern is not visible to the outside world;
[0190] 3. The sequence number pool is disordered again, which decouples the distribution order from the numerical index order;
[0191] 4. Only the distribution index is exposed externally; the internal index value is not exposed.
[0192] 5. Even if an attacker obtains a large number of historical serial numbers, they will not be able to deduce the complete serial number generation pattern.
[0193] Therefore, the method of the present invention effectively prevents the coupon number from being guessed or enumerated in batches while ensuring generation efficiency.
[0194] In summary, this invention proposes an overall scheme combining a pseudo-random dictionary mapping algorithm and a sequence number pool distribution mechanism.
[0195] This invention does not aim to "generate random numbers," but rather:
[0196] Construct a logically pseudo-random dictionary, in which each entry is uniquely identified by a consecutive numerical index.
[0197] The string results are not generated in advance, but are generated as needed during the distribution process using a deterministic mapping algorithm based on the current value index.
[0198] Through the above method, the present invention also achieves the following effects:
[0199] It avoids the overhead of repeated verification during real-time generation; avoids the sharp performance drop when the number space is exhausted later; supports the uniqueness guarantee of numbers in multi-instance deployment scenarios; and provides large-scale number distribution capabilities with paginated management.
[0200] The above description is merely a detailed explanation of preferred embodiments and principles of the present invention. For those skilled in the art, there may be changes in specific implementation methods based on the ideas provided by the present invention, and these changes should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating and distributing pseudo-random dictionaries based on index mapping, characterized in that, Includes the following steps; S1, obtain the character dictionary and the target string length, initialize the character dictionary, and obtain the initial character sequence for subsequent mapping; S2, Randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships; S3. Calculate the total possible string combination space based on the disordered character dictionary and the preset character repetition constraint conditions; S4. Based on the total string combination space, the numerical index is mapped to the corresponding target string as needed using a pseudo-random dictionary mapping method. S5. Group the numerical indexes to form multiple sequence number pools, randomly shuffle the index order within each sequence number pool, and persistently store the shuffled index sequence. S6. During runtime, an actual index value is retrieved from the current sequence number pool according to the distribution cursor order, and the actual index value is converted into the final distributed string result and output based on the pseudo-random dictionary mapping method.
2. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 1, characterized in that, In step S3, the preset character repetition constraint includes allowing character repetition or disallowing character repetition.
3. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 2, characterized in that, In step S3, when the preset character repetition constraint condition is to allow character repetition, the total string combination space is N^L, where N is the size of the character dictionary and L is the length of the target string; When the preset character repetition constraint condition allows character repetition, step 4, mapping the numerical index to the corresponding target string as needed, includes the following process: The numerical index is treated as an N-ary number, and through successive modulo and integer division operations, the numerical index is converted into an N-ary numerical sequence of length L. According to the disordered character dictionary, each digit of the N-ary numerical sequence is used as the index of the character dictionary, and the corresponding characters are mapped sequentially. The characters are then combined in the order of high digit first and low digit last to form the target string.
4. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 2, characterized in that, In step S3, when the preset character repetition constraint condition is that character repetition is not allowed, the target string length L ≤ the character dictionary size N, and the total combination space of the string is the number of permutations P(N,L); When the preset character repetition constraint condition is that character repetition is not allowed, step 4, which maps the numerical index to the corresponding target string as needed, includes the following process: A working copy of the disordered character dictionary is constructed for dynamically removing selected characters; From the highest to the lowest bit, based on the remaining number of characters and the remaining number of bits, the characters are determined bit by bit using the permutation index decomposition method, and the corresponding characters are removed from the working copy after each character is determined. Combine the characters one by one to form the target string.
5. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 3 or 4, characterized in that, In step 5, the method for randomly shuffling the index order within each sequence number pool is as follows: The index set within each sequence number pool is randomly sorted independently, so that the physical storage order of the indexes within the same sequence number pool is independent of the logical order of their corresponding numerical values.
6. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 5, characterized in that, In step 6, retrieving an actual index value from the current sequence number pool according to the distribution cursor order includes the following process: If the index in the current sequence pool has not been exhausted, then read the corresponding out-of-order index value according to the cursor position and increment the cursor. If the index in the current sequence number pool is exhausted, the next pre-generated and persisted sequence number pool will be automatically loaded, the dispatch cursor will be reset, and the value will continue to be retrieved.
7. The pseudo-random dictionary generation and distribution method based on index mapping according to claim 6, characterized in that, In step S6, the final distributed string result is one of the following: coupon code, activation code, invitation code, device serial number, or order number.
8. A pseudo-random dictionary generation and distribution system based on index mapping, used to implement the pseudo-random dictionary generation and distribution method based on index mapping as described in any one of claims 1-7, characterized in that, The pseudo-random dictionary generation and distribution system based on index mapping includes: An initialization module is used to obtain the character dictionary and the length of the target string, initialize the character dictionary, and obtain an initial character sequence for subsequent mapping; The dictionary disorder module is used to randomly rearrange the initial character sequence to generate a disordered character dictionary for constructing pseudo-random dictionary mapping relationships; The space calculation module is used to calculate the total space of possible string combinations based on the disordered character dictionary and the preset character repetition constraints. The mapping module is used to map numerical indices to corresponding target strings as needed, based on the total string combination space, using a pseudo-random dictionary mapping method. The sequence number pool management module is used to group numerical indexes into multiple sequence number pools, randomly shuffle the index order within each sequence number pool, and persistently store the shuffled index sequence. The distribution module is used to retrieve an actual index value from the current sequence number pool according to the distribution cursor order during runtime, and convert the actual index value into the final distributed string result based on the pseudo-random dictionary mapping method and output it.