Pseudo-random number generation system based on generative adversarial network
By introducing genetic algorithm optimization and recursive structural design into the pseudo-random number generator, and combining binary cross entropy loss function training to generate adversarial networks, the problem of difficulty and quality of pseudo-random number generator training in the existing technology is solved, high-quality pseudo-random number generation is achieved, and strict statistical testing is passed.
Patent Information
- Application Number
- CN202411876494.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
Existing pseudo-random number generators based on generative adversarial networks have the problem that it is difficult to effectively train and generate random numbers with low quality, and cannot pass standard statistical testing.
A pseudo-random number generation system based on generative adversarial networks is designed, and the generator population is optimized using genetic algorithms, and a recursive structure is used to design PRNG, which is combined with a binary cross entropy loss function for training.
It effectively solved the problem that discrete GANs cannot use backpropagation algorithm to update generator gradients, improved the quality of pseudo-random sequences, and demonstrated a high degree of security statistical characteristics through NIST SP 800-22 and GM/T 0005-2021 tests.
Smart Images

Figure CN119806476A_ABST
Abstract
Description
Technical Field
[0001] The disclosed embodiments relate to the field of information security technology, and in particular to a pseudo-random number generation system based on a generative adversarial network. Background Art
[0002] A pseudorandom number generator (PRNG) is a deterministic algorithm for generating a series of pseudorandom numbers. It is usually implemented using only software methods and plays a key role in many important fields such as cryptography, secure communication, and computational simulation. PRNG usually has an internal state. After the initial seed is input, it continuously updates the internal state to continuously generate a long series of pseudorandom sequences. However, the generated sequence is not truly random because the pseudorandom number generator maps low-dimensional data to a high-dimensional space. Even if the low-dimensional space is completely random, the output high-dimensional data cannot be guaranteed to be completely random. Nevertheless, it is crucial to ensure the security of the pseudorandom number generator: attackers should not be able to distinguish the sequence from a truly random sequence through calculation.
[0003] In terms of implementation, PRNG consists of five main components: state space ,exist Select the initial state (or "seed") on The probability distribution of , transfer function , output space And the output function In this context, we assume that The PRNG operates via a recursive relation where the state of each step is determined according to Evolution, for . No. The output generated by the step is recorded as The output sequence The existing PRNG algorithms mainly include square median, linear congruential, linear feedback shift register and chaotic system.
[0004] As the research on neural networks continues to deepen and develop, its inherent nonlinearity, complexity, high-dimensional mapping capabilities and parallelism are considered to be a potential research direction for designing PRNGs. Among them, Generative Adversarial Networks (GANs) can generate high-quality pseudo-random numbers through game training between the generator and the discriminator. However, the existing pseudo-random number generators based on GANs have the following problems: (1) It is difficult to train effectively. The output of PRNG is binary discrete data, while the calculation in the neural network is floating-point operation, which makes it impossible to use the commonly used back-propagation algorithm for training; (2) The quality of the generated random numbers is not high. The pseudo-random number sequences generated by the existing schemes have not passed all statistical tests such as NIST SP800-22 under standard parameters.
[0005] Therefore, it is necessary to improve one or more problems existing in the above-mentioned related technical solutions.
[0006] It should be noted that this section is intended to provide background or context for the technical solutions of the present disclosure stated in the claims. The description herein is not admitted to be prior art by virtue of being included in this section. Summary of the invention
[0007] The purpose of the embodiments of the present disclosure is to provide a pseudo-random number generation system based on a generative adversarial network, thereby overcoming one or more problems caused by the limitations and defects of the related art at least to a certain extent.
[0008] According to a first aspect of an embodiment of the present disclosure, a pseudo-random number generation system based on a generative adversarial network is provided, the system comprising: A generator population and a discriminator, wherein the generator population includes a plurality of generators, and the generator includes a first neural network and a second neural network; wherein, The first neural network includes 3 first fully connected layers, 2 first GELU activation functions and 1 first Mod activation function, the first fully connected layers and the first GELU activation function are arranged at intervals, and the output layer is the first Mod activation function; The second neural network includes 4 second fully connected layers, 3 second GELU activation functions and 1 second Mod activation function, the second fully connected layers and the second GELU activation function are arranged at intervals, and the output layer is the second Mod activation function; The discriminator includes 4 layers of 1-dimensional convolutional layers, 5 layers of the third GELU activation function, 1 layer of maximum pooling layer, 2 layers of the third fully connected layers and 1 layer of Sigmoid activation function, the 4 layers of the 1-dimensional convolutional layers and the first 4 layers of the third GELU activation function are connected at intervals, the fourth layer of the fourth GELU activation function, the maximum pooling layer and the third fully connected layer are connected in sequence, the two third fully connected layers are connected at intervals with the fifth layer of the fourth GELU activation function, and the Sigmoid activation function is connected to the second layer of the third fully connected layer.
[0009] According to a second aspect of an embodiment of the present disclosure, a method for using a pseudo-random number generation system based on a generative adversarial network is provided, the method comprising: Inputting the internal state into the generator, optimizing the generator population in combination with a genetic algorithm to obtain the trained generator population, and outputting a training pseudo-random sequence; Inputting the training pseudo-random sequence into the discriminator, and training the discriminator in combination with a first binary cross entropy loss function; Iteratively training the generator population and the discriminator until convergence to obtain a trained generative adversarial network; The random seed is input into the generator of the trained biological adversarial network to obtain a pseudo-random sequence.
[0010] Furthermore, the method further comprises: Initializing the generative adversarial network, specifically including: The weight and threshold of the generator are optimized by using a genetic algorithm; wherein the two-dimensional weight matrix is mapped into one dimension by real number coding, and then concatenated into one dimension to form the final chromosome; Random Generation individuals as the initial population, and use a uniform distribution method to initialize the real value of the chromosome, setting its range to [-1.0, 1.0]; wherein the initial population is the generator population; A second binary cross entropy loss function is used as the loss function of the generator, and the loss function is set as a fitness function.
[0011] Furthermore, the fitness function is expressed as:
[0012] In the formula, is the second binary cross entropy loss function, is the sequence output by the generator, The discriminator is input The probability value of the output , log(0.5) is the ideal generator loss value.
[0013] Furthermore, the step of inputting the internal state into the generator, optimizing the generator population in combination with a genetic algorithm to obtain the trained generator population, and outputting a pseudo-random sequence includes: The internal states are input into The generator In, they are respectively produced The training pseudo-random sequence; Using the second binary cross entropy loss function Calculate the loss value, and calculate the fitness value of each generator in combination with the fitness function; According to the fitness value, the roulette wheel selection method is used to select The generator Make a selection, generate populations, and remove duplicate individuals; Using a real number crossover method to randomly select two of the individuals for a crossover operation; When any of the individuals mutates in the kth gene with a preset probability, a mutation operation is performed on the individual; Adopting an elite strategy to obtain the global optimal individual and update the population; When the maximum number of evolutionary steps is reached or the fitness value reaches a preset value, the training is terminated.
[0014] Furthermore, there are two lengths of The first body and the second individual , use the real number crossover method to crossover individuals:
[0015] in, represents the new first body, represents the new second individual, is the first random number; The individual mutation operation is:
[0016] in, is the upper bound of the gene value, is the lower bound of the gene value, is the current iteration number, is the maximum number of iterations, and are the second and third random numbers between [0, 1], when When the individual's gene value is close to the maximum value, When the individual's gene value is close to the minimum value.
[0017] Furthermore, the step of inputting the training pseudo-random sequence into the discriminator and training the discriminator in combination with the first binary cross entropy loss function includes: The internal state is input into The generator In the above example, the generator with the highest fitness value is selected. , generating the corresponding training pseudo-random sequence; The training pseudo-random sequence is input into the discriminator , evaluate its probability of being a true random sequence ; Input the true random sequence to the discriminator In the equation, we get the true probability ; Using the first binary cross entropy loss function Minimize the probability of the true random sequence , and maximize the true probability ; The Adam optimizer is used to perform gradient descent to update the parameters to complete the training.
[0018] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects: In the embodiments of the present disclosure, through the above-mentioned pseudo-random number generation system based on the generative adversarial network, on the one hand, the PRNG is trained using the generative adversarial network GAGAN optimized by the genetic algorithm, which effectively solves the problem that the discrete GAN cannot use the backpropagation algorithm to update the generator gradient. At the same time, the use of a recursive structure to design the PRNG ensures the simplicity and convenience of seed management and effectively improves the quality of the pseudo-random sequence. On the other hand, after training, the pseudo-random numbers generated by the PRNG designed with a recursive structure successfully passed the NIST SP 800-22 and China National Cryptography Standard GM / T 0005-2021 tests under standard parameters, showing a high degree of security statistical characteristics. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0020] Figure 1 A schematic diagram showing a framework of a pseudo-random number generation system based on a generative adversarial network in an exemplary embodiment of the present disclosure is shown; Figure 2 A schematic diagram showing the structure of a generator in an exemplary embodiment of the present disclosure is shown; Figure 3 A schematic diagram showing the structure of a discriminator in an exemplary embodiment of the present disclosure is shown; Figure 4 A step diagram showing a method for using a pseudo-random number generation system based on a generative adversarial network in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0022] In addition, the accompanying drawings are only schematic illustrations of the embodiments of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0023] In this example implementation, a pseudo-random number generation system based on a generative adversarial network is first provided. Figure 1 As shown in , the pseudo-random number generation system based on the generative adversarial network may include: A generator population and a discriminator, wherein the generator population includes a plurality of generators, and the generator includes a first neural network and a second neural network; wherein, The first neural network includes 3 first fully connected layers, 2 first GELU activation functions and 1 first Mod activation function, the first fully connected layers and the first GELU activation function are arranged at intervals, and the output layer is the first Mod activation function; The second neural network includes 4 second fully connected layers, 3 second GELU activation functions and 1 second Mod activation function, the second fully connected layers and the second GELU activation function are arranged at intervals, and the output layer is the second Mod activation function; The discriminator includes 4 layers of 1-dimensional convolutional layers, 5 layers of the third GELU activation function, 1 layer of maximum pooling layer, 2 layers of the third fully connected layers and 1 layer of Sigmoid activation function, the 4 layers of the 1-dimensional convolutional layers and the first 4 layers of the third GELU activation function are connected at intervals, the fourth layer of the fourth GELU activation function, the maximum pooling layer and the third fully connected layer are connected in sequence, the two third fully connected layers are connected at intervals with the fifth layer of the fourth GELU activation function, and the Sigmoid activation function is connected to the second layer of the third fully connected layer.
[0024] Through the above-mentioned pseudo-random number generation system based on generative adversarial networks, on the one hand, the PRNG is trained using the generative adversarial network GAGAN optimized by genetic algorithms, which effectively solves the problem that discrete GAN cannot use the backpropagation algorithm to update the generator gradient. At the same time, the use of a recursive structure to design PRNG ensures simple and convenient seed management and effectively improves the quality of pseudo-random sequences. On the other hand, after training, the pseudo-random numbers generated by the PRNG designed with a recursive structure have successfully passed the NIST SP 800-22 and China National Cryptography Standard GM / T 0005-2021 tests under standard parameters, showing a high degree of security statistical characteristics.
[0025] Next, we will refer to Figures 1 to 3 The various parts of the pseudo-random number generation system based on the generative adversarial network in this example embodiment are described in more detail.
[0026] In one embodiment, a Genetic Algorithm Optimized Generative Adversarial Network (GAGAN) is proposed, thereby proposing a new type of recursive PRNG. Using GAGAN to train PRNG effectively solves the problem that discrete GAN cannot use the back-propagation algorithm to update the generator gradient. At the same time, the recursive structure is used to design PRNG, which ensures the simplicity and convenience of seed management and effectively improves the quality of pseudo-random sequences.
[0027] Constructing a Generative Adversarial Network: Figure 1 The following is a schematic diagram of the framework of the Generative Adversarial Network. The Generative Adversarial Network includes a generator population and the discriminator , where the generator population By the number The evolutionary population is composed of generator individuals, and the discriminator From an evolutionary perspective, this is a constantly changing environment. These generators receive a seed as input, output a pseudo-random sequence, and let the discriminator The quality of the sequence is judged, so that each generator individual can continue to evolve.
[0028] Generator design: Figure 2 As shown in the figure, it is a schematic diagram of the generator framework. According to the PRNG structure , using the first neural network and the first neural network Simulate functions separately and , and combined together to form a composite neural network, called the generator in GAN. Once the generator Once trained, it can be used as a PRNG.
[0029] Receive initial seed , output the new state , and this state continues as The input of the loop iterates to generate the next new state; at the same time, Output status As Input, output pseudo-random sequence .make Represented as an 8-bit unsigned integer with a value range of [0,255], using Indicates status , Representation sequence , then a single-iteration PRNG can be expressed mathematically as .
[0030] Neural Networks and It is constructed using multiple layers of fully connected layers, which are characterized by high interconnectivity. Each neuron in each layer is connected to neurons in other layers. In terms of activation function selection, the last layer uses the Mod activation function to perform a modulo operation on the data to produce an integer part; the remaining layers use the GELU activation function, which has stronger nonlinear characteristics and can effectively improve the randomness of the output sequence.
[0031] Discriminator design: Figure 3 The figure shows the framework diagram of the discriminator. It can be expressed as a function It receives As input, these integers can be A pseudo-random sequence is generated, or a random sequence that has the properties of true randomness. Processes an input sequence and produces a probability value , which indicates the probability that the sequence is truly random. For a truly random sequence, The ideal output of is 1, while for non-random sequences, the ideal output is 0.
[0032] Discriminator The network consists of one-dimensional convolutional layers and fully connected layers. Except for the output layer which uses the Sigmoid activation function, all activation functions use GELU.
[0033] Furthermore, this example embodiment also provides a method for using a pseudo-random number generation system based on a generative adversarial network. Figure 4 As shown in , the method for using the pseudo-random number generation system based on a generative adversarial network may include: steps S101 to S105.
[0034] Step S101: inputting the internal state into the generator, optimizing the generator population in combination with a genetic algorithm to obtain the trained generator population, and outputting a training pseudo-random sequence; Step S102: inputting the training pseudo-random sequence into the discriminator, and training the discriminator in combination with a binary cross entropy loss function; Step S103: iteratively training the generator population and the discriminator until convergence to obtain a trained generative adversarial network; Step S104: inputting the random seed into the trained generator of the biological adversarial network to obtain a pseudo-random sequence.
[0035] In step S101 to step S103, the training steps of the generative adversarial network can be divided into three parts: initialization, discriminator training and generator training.
[0036] (1) Initialization: The initialization part includes the following operations: 1) Coding: The object optimized by the genetic algorithm is the generator network The network weights and thresholds exist in the form of floating point numbers. Considering that the network weights are two-dimensional, the chromosomes of this application use real number encoding to map the two-dimensional weight matrix into one dimension and splice it into one dimension to form the final chromosome.
[0037] 2) Initialize the population: randomly generate Individuals are used as the initial population, and the chromosome real value is initialized using a uniform distribution method, and its range is set to [-1.0, 1.0].
[0038] 3) Set the fitness function. The fitness function is used to judge the quality of the generator network. It is the standard for evaluating the quality of individuals in the genetic algorithm. It determines which individuals are more likely to be retained to the next generation and their chances of reproducing offspring. This application uses cross entropy as the loss function, so the loss function value of the ideal generator is log(0.5), so this article defines the fitness function as: .
[0039] (2) Discriminator training The discriminator network The training adopts the traditional training method and uses the back propagation algorithm to update the network parameters. The training process is as follows: 1) Set the random seed Input to indivual Then select the one with the highest fitness , and obtain the generated pseudo-random bit sequence (PBS).
[0040] 2) Input this pseudo-random sequence , evaluate its probability of being a true random sequence .
[0041] 3) Similarly, input the real random sequence into , and get the probability .
[0042] 4) The goal is to minimize and maximize , which aims to enhance the ability to distinguish between truly random and pseudo-random sequences.
[0043] 5) Using binary cross entropy loss function To quantify performance.
[0044] 6) Apply the Adam optimizer to perform gradient descent to update the parameters and enhance The ability to identify true randomness.
[0045] (3) Generator training Generator The main task is to maximize The judgment error of The probability assigned to a pseudo-random sequence. Apply the genetic algorithm to the training of the generator, apply selection, crossover, mutation and other operations to the population, and ultimately allow individuals with high fitness to reproduce to the next generation. In other words, the process of reproduction is used to update the parameters of the generator network.
[0046] The specific training steps are as follows: 1) Using random seeds Input to indivual In, they are respectively produced pseudo-random sequences, and input each ; Use binary cross entropy loss function Calculate the loss value and thus calculate the fitness value of each generator.
[0047] 2) Selection: According to the fitness value, the roulette wheel selection method is used to select indivual Make a selection, and the resulting scale is also The average fitness of the selected individuals is high, but there will be repeated individuals, and the crossover of repeated individuals is meaningless, so repeated individuals must be screened out during the selection process. 3) Crossover: In each crossover, two individuals are randomly selected and the crossover operation is performed without exceeding the crossover probability.
[0048] Suppose there are two lines of length Individual and , the real number crossover method is used to cross the individuals
[0049] in and Represent new individuals, is randomly selected. Then the hybridized individuals are convex combinations of the parent individuals, thus fully integrating the genes of the parent individuals. At the same time, the random number introduced It increases the diversity of individuals and enhances the local search capability of the algorithm, which helps the algorithm develop the optimal fusion ratio during the iteration process.
[0050] 4) Mutation: When an individual mutates in the kth gene with a certain probability, the mutation operation of the individual is
[0051] in and are the upper and lower bounds of the gene value, is the current iteration number, is the maximum number of iterations, and is a random number between [0, 1]. Mainly affects the degree of variation of individuals. gradually approaches the maximum value when This ensures that the gene value increases or decreases with equal probability. and Under the joint action of , the degree of mutation is larger in the initial stage of the algorithm, ensuring the global search capability. As the number of iterations increases, the degree of mutation decreases continuously, ensuring the local search capability and prompting individuals to converge to the global optimal solution.
[0052] 5) Population update: The probability of an individual in the population being selected is proportional to the value of the fitness function of the individual. At the same time, in order to prevent the good solutions generated by the population during the iteration process from being quickly destroyed due to crossover and mutation, this application adopts an elite strategy, that is, retaining the global optimal individual separately from the population.
[0053] 6) Termination condition: When the maximum number of evolutionary steps is reached or the fitness value reaches a certain value, the algorithm terminates.
[0054] In step S104, the pseudo-random sequence is input into the trained discriminator, and a probability value is output; based on the probability value, a pseudo-random number is obtained.
[0055] In a specific embodiment, in combination with the drawings in the embodiments of the present application, a pseudo-random number generator based on a generative adversarial network is designed and implemented, with a seed of 256 bits and generating a 2048-bit random number in each iteration, to clearly and completely describe the technical solution in the embodiments of the present application.
[0056] Constructing a Generative Adversarial Network: Figure 1 The following is a schematic diagram of the framework of the Generative Adversarial Network. The system architecture (i.e., Generative Adversarial Network) includes a population of generators and the discriminator , where population The evolutionary population consists of 100 generator individuals, the discriminator Judging the quality of the input sequence drives each generator to evolve continuously.
[0057] Generator design: based on PRNG structure , using a neural network and Simulate functions separately and ,in Receive initial seed , output the new state , and this state continues as The input of the loop iterates to generate the next new state; at the same time, Output status As Input, output pseudo-random sequence .make Represented as an 8-bit unsigned integer with a value range of [0,255], using Indicates status , Representation sequence , then the single-iteration pseudo-random number generator can be mathematically expressed as .
[0058] like Figure 2 As shown, the neural network and It is constructed using multiple layers of fully connected layers, which are characterized by high interconnectivity. Each neuron in each layer is connected to neurons in other layers. The structure of uses three fully connected layers with parameters (32, 100), (100, 200) and (200, 32). This parameter configuration increases the initial input dimension from 32 to 100-dimensional and 200-dimensional intermediate representations, and then reduces the dimension to 32, thereby ensuring that the internal state The consistency of the transformation. Then, the sub-network The fully connected layer is also used, and its parameterization is as follows: (32, 100), (100, 200), (200, 400) and (400, 256), so that Starting from the initial 32 dimensions, the dimensions are gradually increased until they reach a peak of 400, and then the dimensions are shrunk to produce a 256-dimensional output. In terms of activation function selection, the last layer uses the Mod activation function to perform a modulo operation on the data to produce the integer part; the remaining layers use the GELU activation function because it has stronger nonlinear characteristics and can effectively improve the randomness of the output sequence.
[0059] Discriminator Design: Discriminator It can be expressed as a function It receives As input, these integers can be A pseudo-random sequence is generated, or a random sequence that has the properties of true randomness. Processes an input sequence and produces a probability value , which indicates the likelihood that the sequence is truly random.
[0060] like Figure 3 As shown, the discriminator The network consists of 4 one-dimensional convolutional layers and 2 fully connected layers. The parameters of the one-dimensional convolutional layer Conv1d are (1,4,2), (4,4,2), (4,4,2) and (4,4,2); the parameters of the fully connected layer are (1004,4) and (4,1). The MaxPool pooling function is used between the one-dimensional convolutional layer and the fully connected layer. Except for the output layer which uses the Sigmoid activation function, all activation functions use GELU.
[0061] The pseudo-random number generator training steps of this application can be divided into three parts: initialization, discriminator training and generator training.
[0062] (1) Initialization: The initialization part includes the following operations: 1) Coding: The object optimized by the genetic algorithm is the generator network The chromosome of the present application adopts real number coding to map the two-dimensional weight matrix into one dimension and concatenate it into one dimension to form the final chromosome.
[0063] 2) Initialize the population: Randomly generate 100 individuals as the initial population. The specific method is: use the uniform distribution method to initialize the chromosome real value and set its range to [-1.0, 1.0].
[0064] 3) Set the fitness function. This application uses cross entropy as the loss function, so the ideal generator loss function value is log(0.5), so this article defines the fitness function as .
[0065] (2) Discriminator training The discriminator network The training adopts the traditional training method and uses the back propagation algorithm to update the network parameters. The training process is as follows: 1) Set the random seed Input to Among the generators, we then select the one with the highest fitness. , and obtain the generated pseudo-random bit sequence PBS.
[0066] 2) Input this PBS , evaluate its probability of being a true random sequence .
[0067] 3) Similarly, input the real random sequence into , and get the probability .
[0068] 4) The goal is to minimize and maximize , enhancing the ability to distinguish between true random and pseudo-random sequences.
[0069] 5) Using binary cross entropy loss function To quantify performance.
[0070] 6) Apply the Adam optimizer to perform the gradient descent algorithm to update Parameters.
[0071] (3) Generator training Generator The main task is to maximize This application uses a genetic algorithm to select, cross, mutate and other operations in the population to eventually obtain individuals with high fitness. The specific training steps are as follows: 1) Using random seeds Input up to 100 In the example above, 100 pseudo-random sequences are generated and input into ; Use binary cross entropy loss function Calculate the loss value and thus calculate the fitness value of each generator.
[0072] 2) Selection: According to the fitness value, 100 Make a selection, and the resulting scale is also The average fitness of the selected individuals is high, but there will be repeated individuals, and the crossover of repeated individuals is meaningless, so repeated individuals must be screened out during the selection process. 3) Crossover: Set the maximum number of crossovers to 10,000. In each crossover, randomly select 2 individuals and perform the crossover operation without exceeding the crossover probability.
[0073] Suppose there are two lines of length Individual and , the real number crossover method is used to cross the individuals
[0074] in and Represent new individuals, It is randomly selected.
[0075] 4) Mutation: When an individual mutates in the 𝑘th gene with a certain probability, the mutation operation of the individual is
[0076] in and are the upper and lower bounds of the gene value, is the current iteration number, is the maximum number of iterations, and is a random number between [0, 1].
[0077] 5) Population update: The probability of an individual in the population being selected is proportional to the value of the fitness function of the individual. At the same time, this application adopts an elite strategy, that is, the global optimal individual is retained separately from the population.
[0078] 6) Termination condition: The algorithm terminates when the maximum number of evolutionary steps reaches 10,000 or the fitness value reaches a certain value.
[0079] In a specific embodiment, the present application conducts experiments on the performance and effectiveness of the proposed pseudo-random number generator using the NIST SP800-22 standard and the Chinese standard GM / T 0005-2021 test. The experiment selected a PaddlePaddle platform equipped with a Tesla V100 GPU graphics processor with 16GB of memory, and the program environment included Python version 3.7.4 and PaddlePaddle-GPU 2.4.0.
[0080] The NIST SP800-22 standard test proposed by the National Institute of Standards and Technology is one of the widely recognized statistical test standards. This standard includes 15 main items and 188 sub-tests, which evaluate the randomness quality of the sequence from multiple standards, such as frequency test, block frequency test within block, binary matrix rank test, etc. After testing each pseudo-random sequence, it will give -value as the test result. The standard sets the significance level to (Recommended between 0.001 and 0.01). If -value is greater than , it indicates that the test sequence has a high degree of randomness credibility in this project , which means that the sequence passes the randomness test; otherwise, it fails. For a single test, the SP800-22 standard recommends that the number of sequences tested be at least , the minimum binary length is .
[0081] Table 1 NIST SP800-22 test results
[0082] Similar to the NIST SP800-22 randomness test standard, the China National Cryptography Administration has also proposed a randomness test standard GM / T 0005-2021. This test standard contains 15 tests. Compared with the NIST test, it excludes the random run test, random run variant test, non-overlapping template matching test, and overlapping template matching test, and adds the poker test, run distribution test, binary derivative test, and autocorrelation test. GM / T 0005-2021 receives an input of typically 1,000,000 bits and calculates the pass rate of the data generation sample. -value and significance level -value to create a pass / fail metric.
[0083] This application adopts the experimental setup proposed in GM / T 0005-2021, including 1000 samples, each containing 1,000,000 bits. According to the standards outlined in GM / T 0005-2021, the sample passing rate -value should not be less than 98.1%, which is the significance level of the sample distribution uniformity test -value shall not be less than 0.01. Table 2 shows the specific test results, indicating that the proposed pseudo-random number generator successfully passed all 15 tests, showing excellent performance and the ability to meet application requirements.
[0084] Table 2 GM / T 0005-2021 test results
[0085] Through the above-mentioned pseudo-random number generation system based on generative adversarial networks, on the one hand, the PRNG is trained using the generative adversarial network GAGAN optimized by genetic algorithms, which effectively solves the problem that discrete GAN cannot use the backpropagation algorithm to update the generator gradient. At the same time, the use of a recursive structure to design PRNG ensures simple and convenient seed management and effectively improves the quality of pseudo-random sequences. On the other hand, after training, the pseudo-random numbers generated by the PRNG designed with a recursive structure have successfully passed the NIST SP 800-22 and China National Cryptography Standard GM / T 0005-2021 tests under standard parameters, showing a high degree of security statistical characteristics.
[0086] It should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", etc. in the above description indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the embodiments of the present disclosure and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the embodiments of the present disclosure.
[0087] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0088] In the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0089] In the embodiments of the present disclosure, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include the first and second features being in direct contact, or may include the first and second features not being in direct contact but being in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes the first feature being directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes the first feature being directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.
[0090] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification.
[0091] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A pseudo-random number generation system based on a generative adversarial network, characterized in that: The system includes: A generator population and a discriminator, wherein the generator population includes a plurality of generators, and the generator includes a first neural network and a second neural network; wherein, The first neural network includes 3 first fully connected layers, 2 first GELU activation functions and 1 first Mod activation function, the first fully connected layers and the first GELU activation function are arranged at intervals, and the output layer is the first Mod activation function; The second neural network includes 4 second fully connected layers, 3 second GELU activation functions and 1 second Mod activation function, the second fully connected layers and the second GELU activation function are arranged at intervals, and the output layer is the second Mod activation function; The discriminator includes 4 layers of 1-dimensional convolutional layers, 5 layers of the third GELU activation function, 1 layer of maximum pooling layer, 2 layers of the third fully connected layers and 1 layer of Sigmoid activation function, the 4 layers of the 1-dimensional convolutional layers and the first 4 layers of the third GELU activation function are connected at intervals, the fourth layer of the fourth GELU activation function, the maximum pooling layer and the third fully connected layer are connected in sequence, the two third fully connected layers are connected at intervals with the fifth layer of the fourth GELU activation function, and the Sigmoid activation function is connected to the second layer of the third fully connected layer.
2. A method for using a pseudo-random number generation system based on a generative adversarial network, characterized in that: The method includes: Inputting the internal state into the generator, optimizing the generator population in combination with a genetic algorithm to obtain the trained generator population, and outputting a training pseudo-random sequence; Inputting the training pseudo-random sequence into the discriminator, and training the discriminator in combination with a first binary cross entropy loss function; Iteratively training the generator population and the discriminator until convergence to obtain a trained generative adversarial network; The random seed is input into the generator of the trained biological adversarial network to obtain a pseudo-random sequence.
3. The method for using the pseudo-random number generation system based on a generative adversarial network according to claim 2, characterized in that: The method further includes: Initializing the generative adversarial network, specifically including: The weight and threshold of the generator are optimized by using a genetic algorithm; wherein the two-dimensional weight matrix is mapped into one dimension by real number coding, and then concatenated into one dimension to form the final chromosome; Random Generation individuals as the initial population, and use a uniform distribution method to initialize the real value of the chromosome, setting its range to [-1.0, 1.0]; wherein the initial population is the generator population; A second binary cross entropy loss function is used as the loss function of the generator, and the loss function is set as a fitness function.
4. The method for using the pseudo-random number generation system based on a generative adversarial network according to claim 3, characterized in that: The expression of the fitness function is: In the formula, is the second binary cross entropy loss function, is the sequence output by the generator, The discriminator is input The probability value of the output , log(0.5) is the ideal generator loss value.
5. The method for using the pseudo-random number generation system based on a generative adversarial network according to claim 4, characterized in that: The steps of inputting the internal state into the generator, optimizing the generator population in combination with a genetic algorithm to obtain the trained generator population, and outputting a pseudo-random sequence include: The internal states are input into The generator In, they are respectively produced The training pseudo-random sequence; Using the second binary cross entropy loss function Calculate the loss value, and calculate the fitness value of each generator in combination with the fitness function; According to the fitness value, the roulette wheel selection method is used to select The generator Make a selection, generate populations, and remove duplicate individuals; Using a real number crossover method to randomly select two of the individuals for a crossover operation; When any of the individuals mutates in the kth gene with a preset probability, a mutation operation is performed on the individual; Adopting an elite strategy to obtain the global optimal individual and update the population; When the maximum number of evolutionary steps is reached or the fitness value reaches a preset value, the training is terminated.
6. The method for using the pseudo-random number generation system based on a generative adversarial network according to claim 5, characterized in that: There are two lengths The first body and the second individual , use the real number crossover method to crossover individuals: in, represents the new first body, represents the new second individual, is the first random number; The individual mutation operation is: in, is the upper bound of the gene value, is the lower bound of the gene value, is the current iteration number, is the maximum number of iterations, and are the second and third random numbers between [0, 1], when When the individual's gene value is close to the maximum value, When the individual's gene value is close to the minimum value.
7. The method for using the pseudo-random number generation system based on a generative adversarial network according to claim 6, characterized in that: Inputting the training pseudo-random sequence into the discriminator, and training the discriminator in combination with a first binary cross entropy loss function, comprises: The internal state is input into The generator In the above example, the generator with the highest fitness value is selected. , generating the corresponding training pseudo-random sequence; The training pseudo-random sequence is input into the discriminator , evaluate its probability of being a true random sequence ; Input the true random sequence into the discriminator In the equation, we get the true probability ; Using the first binary cross entropy loss function Minimize the probability of the true random sequence , and maximize the true probability ; The Adam optimizer is used to perform gradient descent to update the parameters to complete the training.