Random number generation methods and apparatus, non-volatile storage media, electronic devices

By generating truly random numbers using particle motion in multiple energy domains within the Boltzmann equation model, the problem of insufficient uniqueness of random numbers in existing technologies is solved, thereby improving data security and encryption strength.

CN115774543BActive Publication Date: 2026-03-10CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-06
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing technologies cannot effectively guarantee the uniqueness of random numbers, leading to reduced data security.

Method used

By constructing a Boltzmann equation model, true random numbers are generated using the particle motion in multiple target energy domains. The uniqueness of these random numbers is ensured by combining the particle's motion velocity, initial mass, and quantity.

Benefits of technology

The generated random numbers are highly unique and random, which improves data security, prevents duplication, and enhances the security of data encryption and system interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115774543B_ABST
    Figure CN115774543B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for generating random numbers, a non-volatile storage medium, and an electronic device. The method includes: determining multiple target energy domains and initializing the parameters of each target energy domain; collecting particles in each target energy domain and determining the number of particles collected in each target energy domain; determining the energy of each target energy domain based on the number of particles collected, the initial mass of the particles in each target energy domain, and the kinetic mass of the particles in each target energy domain; and generating random numbers based on the kinetic velocity of the particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain. This application solves the technical problem of reduced data security caused by the inability of related technologies to ensure the uniqueness of random numbers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer software technology, and more specifically, to a method and apparatus for generating random numbers, a non-volatile storage medium, and an electronic device. Background Technology

[0002] When the two programs interact, a unique random number is used to represent the work order number to ensure its uniqueness; when encrypting / decrypting files and interacting with the system, a unique random number is used as the key; therefore, ensuring the uniqueness of the random number is an important condition for ensuring data security.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a method and apparatus for generating random numbers, a non-volatile storage medium, and an electronic device, to at least solve the technical problem of reduced data security caused by the inability of related technologies to ensure the uniqueness of random numbers.

[0005] According to one aspect of the embodiments of this application, a method for generating random numbers is provided, comprising: determining a plurality of target energy domains; initializing parameters of each target energy domain, wherein the target energy domain is a region where particles move; the parameters include: the velocity of particles in each target energy domain, the initial mass of particles in each target energy domain, and the mass of particles moving in each target energy domain; collecting particles in each target energy domain respectively, and determining the number of particles collected in each target energy domain; determining the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of particles in each target energy domain, and the mass of particles moving in each target energy domain; and generating random numbers based on the velocity of particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0006] Optionally, multiple target energy domains are determined, and the parameters of each target energy domain are initialized, including: determining a first target energy domain, initializing the velocity of particles in the first target energy domain to a first velocity, initializing the initial mass of particles in the first target energy domain to a first mass, and initializing the mass of particles in the first target energy domain to a second mass; determining a second target energy domain, initializing the velocity of particles in the second target energy domain to a second velocity, initializing the initial mass of particles in the second target energy domain to a first mass, and initializing the mass of particles in the second target energy domain to a third mass; determining a third target energy domain, initializing the velocity of particles in the third target energy domain to a third velocity, initializing the initial mass of particles in the third target energy domain to a first mass, and initializing the mass of particles in the third target energy domain to a fourth mass; determining a fourth target energy domain, initializing the velocity of particles in the fourth target energy domain to a fourth velocity. The initial mass of the particles in the fourth target energy domain is initialized to the first mass, and the kinetic mass of the particles in the fourth target energy domain is initialized to the fifth mass. The fifth target energy domain is determined, and the kinetic velocity of the particles in the fifth target energy domain is initialized to the fifth velocity. The initial mass of the particles in the fifth target energy domain is initialized to the first mass, and the kinetic mass of the particles in the fifth target energy domain is initialized to the sixth mass. Wherein, the temperature of the first target energy domain is greater than the temperature of the second target energy domain, the temperature of the second target energy domain is greater than the temperature of the third target energy domain, the temperature of the third target energy domain is greater than the temperature of the fourth target energy domain, and the temperature of the fourth target energy domain is greater than the temperature of the fifth target energy domain; the first velocity is greater than the second velocity, the second velocity is greater than the third velocity, the third velocity is greater than the fourth velocity, and the fourth velocity is greater than the fifth velocity; the second mass is less than the third mass, the third mass is less than the fourth mass, the fourth mass is less than the fifth mass, the fifth mass is less than the sixth mass, and the sixth mass is less than the first mass.

[0007] Optionally, the energy of each target energy domain is determined based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the kinetic mass of the particles in each target energy domain. This includes: determining a first difference between a first mass and a second mass; determining a first product of the first difference, a first quantity, and a preset value, and determining the first product as the first energy of the first target energy domain, wherein the first quantity is the number of particles collected in the first target energy domain; determining a second difference between a first mass and a third mass; determining a second product of the second difference, a second quantity, and a preset value, and determining the second product as the second energy of the second target energy domain, wherein the second quantity is the number of particles collected in the second target energy domain; determining a second difference between a first mass and a fourth mass ... fourth mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a fourth mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a fourth mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a fourth mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a third mass; determining a second difference between a first mass and a fourth mass; determining a second difference The third difference in mass; the third product of the third difference, the third quantity, and the preset value is determined, and the third product is determined as the third energy of the third target energy domain, where the third quantity is the number of particles collected in the third target energy domain; the fourth difference between the first mass and the fifth mass is determined; the fourth product of the fourth difference, the fourth quantity, and the preset value is determined, and the fourth product is determined as the fourth energy of the fourth target energy domain, where the fourth quantity is the number of particles collected in the fourth target energy domain; the fifth difference between the first mass and the sixth mass is determined; the fifth product of the fifth difference, the fifth quantity, and the preset value is determined, and the fifth product is determined as the fifth energy of the fifth target energy domain, where the fifth quantity is the number of particles collected in the first target energy domain.

[0008] Optionally, based on the particle velocity in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain, random numbers are generated, including: determining a first sine value of a first energy, determining the product of the first sine value and a first quantity, and determining a first ratio of the product to a first velocity; determining a first cosine value of a second energy, determining the product of the first cosine value and a second quantity, and determining a second ratio of the product to a second velocity; determining a tangent value of a third energy, determining the product of the tangent value and a third quantity, and determining a third ratio of the product to a third velocity. Determine the second sine value of the fourth energy, the product of the second sine value and the fourth quantity, and the fourth ratio of the product to the fourth velocity; determine the second cosine value of the fifth energy, the product of the second cosine value and the fifth quantity, and the fifth ratio of the product to the fifth velocity; determine the sixth difference between the first ratio and the second ratio, the first sum of the sixth difference and the third ratio, the seventh difference between the first sum and the fourth ratio, and the second sum of the seventh difference and the fifth ratio; determine the absolute value of the second sum, and set the absolute value as a random number.

[0009] Optionally, the method for generating random numbers further includes: if a particle moves from an initial target energy domain to an end target energy domain, the particle's velocity changes from the velocity of the particle in the initial target energy domain to the velocity of the particle in the end target energy domain, and the particle's mass changes from the mass of the particle in the initial target energy domain to the mass of the particle in the end target energy domain.

[0010] Optionally, the method for generating random numbers further includes: determining a time period, initializing the parameters of each target energy domain within the time period, and generating random numbers, wherein the random numbers generated within each time period are unique true random numbers.

[0011] Optionally, after generating random numbers based on the particle velocity in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain, the method further includes at least one of the following: adding different random numbers to different programs; adding random numbers to a key used for file encryption / decryption, or to a parameter key used for system interaction.

[0012] According to another aspect of the embodiments of this application, a random number generation apparatus is also provided, comprising: an initialization module, configured to determine a plurality of target energy domains and initialize parameters of each target energy domain, wherein the target energy domain is a region in which particles move, and the parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the mass of the particles in each target energy domain; a first determining module, configured to collect particles in each target energy domain and determine the number of particles collected in each target energy domain; a second determining module, configured to determine the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the mass of the particles in each target energy domain; and a third determining module, configured to generate random numbers based on the velocity of the particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0013] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, which stores a program, wherein the program controls the device where the non-volatile storage medium is located to execute the above-described random number generation method when it runs.

[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, the processor being configured to run a program stored in the memory, wherein the program executes the above-described method for generating random numbers during runtime.

[0015] In this embodiment, multiple target energy domains are determined, and the parameters of each target energy domain are initialized. Each target energy domain is a region where particles move. The parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain. Particles are collected in each target energy domain, and the number of particles collected in each target energy domain is determined. The energy of each target energy domain is determined based on the number of particles collected, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain. The energy of each target energy domain is determined based on the velocity of the particles in each target energy domain. By considering the degree of randomness, the number of particles collected in each target energy domain, and the method of generating random numbers for each target energy domain, a Boltzmann equation model is constructed. This model establishes multiple different energy domains, initializes each domain to randomly distribute particles, and causes particles to move at different speeds. The random thermal motion of the particles is combined with the parameters of each energy domain to generate highly random true random numbers. This ensures the uniqueness of the random numbers, improves data security, and solves the problem of reduced data security caused by the inability of related technologies to guarantee the uniqueness of random numbers. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 This is a hardware structure block diagram of a computer terminal (or mobile device) that implements a method for generating random numbers according to an embodiment of this application.

[0018] Figure 2 This is a flowchart of a random number generation method according to an embodiment of this application;

[0019] Figure 3 This is a structural diagram of a random number generation apparatus according to an embodiment of this application;

[0020] Figure 4 This is a flowchart of generating random numbers according to an embodiment of this application. Detailed Implementation

[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application are explained below:

[0024] True random numbers: Unlike pseudo random numbers, they are numbers obtained based on physical phenomena, such as dice rolling, nuclear fission, and noise generated by electronic components. True random numbers can be expressed in any form, such as numbers, letters, characters, combinations of letters and numbers, combinations of characters and numbers, or combinations of characters and letters.

[0025] Primary key: also known as the primary key, is one or more fields in a table. The value of the primary key is used to uniquely identify a record in the table and is a unique row identifier.

[0026] Boltzmann equations: partial differential equations used to describe the thermodynamic statistical behavior of non-thermodynamic equilibrium states.

[0027] In related technologies, random numbers are typically generated using equations with multiple solutions. However, after multiple solutions, these equations may yield the same result as before, thus compromising the uniqueness of the random numbers. To address this issue, this application constructs a highly random physical model using an unsolvable mathematical problem and incorporates the instantaneous coordinates and angles between multiple particles into the calculation, resulting in a highly unique random number. This ensures the security and non-repetition of the random number algorithm, thereby resolving the aforementioned problem. The following provides a detailed explanation.

[0028] According to an embodiment of this application, a method embodiment for generating random numbers is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] The methods and embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing a method for generating random numbers is shown. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0030] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0031] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the random number generation method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the random number generation method of the application described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0033] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0034] Under the above operating environment, embodiments of this application provide a method for generating random numbers. Figure 2 This is a flowchart of a random number generation method provided according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0035] Step S202: Determine multiple target energy domains and initialize the parameters of each target energy domain. The target energy domain is the region where the particles move. The parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain.

[0036] In step S202, a physical model is constructed for the motion of the particles, and multiple target energy domains are constructed in the physical model, for example, five energy domains are constructed; and each target energy domain is initialized according to the rule that from the first target energy domain to the fifth target energy domain, the temperature in the target energy domain increases sequentially, the velocity of the particles in the target energy domain increases sequentially, and the mass of the particles in the target energy domain decreases sequentially; at the same time, the initial mass of the particles in each target energy domain is initialized to the same value.

[0037] Step S204: Collect particles in each target energy domain and determine the number of particles collected in each target energy domain.

[0038] In step S204, particles are collected in the initialized target energy domain, and the number of particles collected in each target energy domain is recorded.

[0039] Step S206: Determine the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the kinetic mass of the particles in each target energy domain.

[0040] In step S206, the initial mass of the particles in each target energy domain after initialization, the kinetic mass of the particles in each target energy domain after initialization, and the number of particles collected in each target energy domain as recorded in step S204 are combined to calculate the energy of each target energy domain.

[0041] Step S208: Generate random numbers based on the movement speed of particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0042] In step S208, the motion velocity of the particles in each target energy domain after initialization, the number of particles collected in each target energy domain recorded in step S204, and the energy of each target energy domain obtained in step 206 are combined to calculate a random number.

[0043] Through the above steps, a lightweight random number generation algorithm is provided. Particles are randomly collected from various target energy domains. The number of particles collected in each target energy domain is combined with the particle's velocity, initial mass, and moving mass in each domain to generate a random number. The disordered nature of particle thermal motion ensures that each generated random number cannot be replicated, improving data security. Furthermore, periodically updating the number of particles in each target energy domain further enhances the algorithm's security, guaranteeing the uniqueness of the random number. This achieves the technical effect of improving data security.

[0044] According to an optional embodiment of this application, multiple target energy domains are determined, and the parameters of each target energy domain are initialized, including: determining a first target energy domain, initializing the velocity of particles in the first target energy domain to a first velocity, initializing the initial mass of particles in the first target energy domain to a first mass, and initializing the mass of particles in the first target energy domain to a second mass; determining a second target energy domain, initializing the velocity of particles in the second target energy domain to a second velocity, initializing the initial mass of particles in the second target energy domain to a first mass, and initializing the mass of particles in the second target energy domain to a third mass; determining a third target energy domain, initializing the velocity of particles in the third target energy domain to a third velocity, initializing the initial mass of particles in the third target energy domain to a first mass, and initializing the mass of particles in the third target energy domain to a fourth mass; determining a fourth target energy domain, initializing the velocity of particles in the fourth target energy domain to a third velocity, initializing the initial mass of particles in the third target energy domain to a first mass, and initializing the mass of particles in the third target energy domain to a fourth mass; and determining a fourth target energy domain, initializing the velocity of particles in the fourth target energy domain to a third velocity. For the fourth velocity, the initial mass of the particles in the fourth target energy domain is initialized to the first mass, and the kinetic mass of the particles in the fourth target energy domain is initialized to the fifth mass; the fifth target energy domain is determined, the kinetic velocity of the particles in the fifth target energy domain is initialized to the fifth velocity, the initial mass of the particles in the fifth target energy domain is initialized to the first mass, and the kinetic mass of the particles in the fifth target energy domain is initialized to the sixth mass; wherein, the temperature of the first target energy domain is greater than the temperature of the second target energy domain, the temperature of the second target energy domain is greater than the temperature of the third target energy domain, the temperature of the third target energy domain is greater than the temperature of the fourth target energy domain, and the temperature of the fourth target energy domain is greater than the temperature of the fifth target energy domain; the first velocity is greater than the second velocity, the second velocity is greater than the third velocity, the third velocity is greater than the fourth velocity, the fourth velocity is greater than the fifth velocity; the second mass is less than the third mass, the third mass is less than the fourth mass, the fourth mass is less than the fifth mass, the fifth mass is less than the sixth mass, and the sixth mass is less than the first mass.

[0045] In this embodiment, the particle velocity, initial mass, and velocity of particles in each of the determined target energy domains are initialized. Simultaneously, the temperature of each target energy domain is initialized. For example, if five target energy domains are determined, their temperatures are initialized according to a rule that the temperature increases sequentially from the first to the fifth target energy domain, where the first target energy domain has the highest temperature and the fifth target energy domain has the lowest temperature. Since there is a direct proportional relationship between temperature and particle velocity, the particle velocity in these five target energy domains is initialized according to a rule that the particle velocity increases sequentially from the first to the fifth target energy domain. The particles in the first target energy domain move the fastest, and the particles in the fifth target energy domain move the slowest. For example, let the velocity of the particles in the first target energy domain be V1, and initialize it with a value of V1 = 5; let the velocity of the particles in the second target energy domain be V2, and initialize it with a value of V2 = 4; let the velocity of the particles in the third target energy domain be V3, and initialize it with a value of V3 = 3; let the velocity of the particles in the fourth target energy domain be V4, and initialize it with a value of V4 = 2; let the velocity of the particles in the fifth target energy domain be V5, and initialize it with a value of V5 = 1. Then the particles in each target energy domain will move according to the assigned velocity. For the five target energy domains mentioned above, particles are randomly assigned according to the rule that the number of particles decreases sequentially from the first target energy domain to the fifth target energy domain. The number of particles in each target energy domain is initialized, and the initial mass of the particles in each target energy domain is initialized to the same mass (i.e., the first mass). For example, if the initial mass of each target energy domain is denoted as M, and M is assigned the value M=10 during initialization, then the initial mass of the particles randomly assigned to the five target energy domains will all be 10. The velocity of particles in each target energy domain is initialized according to the rule that the mass of the particles increases or decreases sequentially from the first to the fifth target energy domain. The mass of the particles in the first target energy domain is the smallest, and the mass of the particles in the fifth target energy domain is the largest. For example, let m1 be the mass of the particles in the first target energy domain, and assign m1 = 5 during initialization; let m2 be the mass of the particles in the second target energy domain, and assign m2 = 6 during initialization; let m3 be the mass of the particles in the third target energy domain, and assign m3 = 7 during initialization; let m4 be the mass of the particles in the fourth target energy domain, and assign m4 = 8 during initialization; let m5 be the mass of the particles in the fifth target energy domain, and assign m1 = 9 during initialization. Then the mass of the particles in each target energy domain is the mass assigned above.The same rules apply when initializing the target energy domain in the next cycle.

[0046] According to another optional embodiment of this application, the energy of each target energy domain is determined based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the kinetic mass of the particles in each target energy domain, including: determining a first difference between a first mass and a second mass; determining a first product of the first difference, a first quantity, and a preset value, and determining the first product as the first energy of the first target energy domain, wherein the first quantity is the number of particles collected in the first target energy domain; determining a second difference between a first mass and a third mass; determining a second product of the second difference, a second quantity, and a preset value, and determining the second product as the second energy of the second target energy domain, wherein the second quantity is the number of particles collected in the second target energy domain; determining a second difference between a first mass and a third mass; determining a second product of the second difference, a second quantity, and a preset value, and determining the second product as the second energy of the second target energy domain, wherein the second quantity is the number of particles collected in the second target energy domain; determining a second mass of the first mass and a third mass; determining a second mass of the second mass and a third mass ... The third difference between the first mass and the fourth mass; the third product of the third difference, the third quantity, and a preset value is determined, and the third product is determined as the third energy of the third target energy domain, where the third quantity is the number of particles collected in the third target energy domain; the fourth difference between the first mass and the fifth mass is determined; the fourth product of the fourth difference, the fourth quantity, and a preset value is determined, and the fourth product is determined as the fourth energy of the fourth target energy domain, where the fourth quantity is the number of particles collected in the fourth target energy domain; the fifth difference between the first mass and the sixth mass is determined; the fifth product of the fifth difference, the fifth quantity, and a preset value is determined, and the fifth product is determined as the fifth energy of the fifth target energy domain, where the fifth quantity is the number of particles collected in the first target energy domain.

[0047] In this embodiment, when generating random numbers, particles are collected from the aforementioned determined target energy domain, and the number of collected particles is recorded. The number of collected particles is the number of particles belonging to the aforementioned target energy domain at the time of collection. The number of particles collected in the first target energy domain is recorded as N1, the number of particles collected in the second target energy domain is recorded as N2, the number of particles collected in the third target energy domain is recorded as N3, the number of particles collected in the fourth target energy domain is recorded as N4, and the number of particles collected in the fifth target energy domain is recorded as N5. The difference between the initial mass M and the moving mass m1 of the particles in the first target energy domain (M-m1) (i.e., the first difference) is determined. The product of the difference between the initial mass M and the moving mass m1 of the particles in the first target energy domain and the number N1 of particles collected in the first target energy domain: (M-m1)*N1, is multiplied by a preset value to determine the energy E1 of the first target energy domain. The preset value is the square of the speed of light (C). In this embodiment, the speed of light (C) is taken as 299,792,458 m / s. Therefore, the energy E1 of the first target energy domain is: E1 = (M-m1)*C 2*N1; Similarly, the energy of the second target energy domain, E2: E2=(M-m2)*C 2 *N2; Energy E3 of the third target energy domain: E3=(M-m3)*C 2 *N3; Energy of the fourth target energy domain, E4: E4 = (M - m4) * C 2 *N4; Energy of the fifth target energy domain E5: E5=(M-m5)*C 2 *N5.

[0048] According to another optional embodiment of this application, based on the movement velocity of particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain, a random number is generated, including: determining a first sine value of a first energy, determining the product of the first sine value and a first quantity, and determining a first ratio of the product to a first velocity; determining a first cosine value of a second energy, determining the product of the first cosine value and a second quantity, and determining a second ratio of the product to a second velocity; determining a tangent value of a third energy, determining the product of the tangent value and a third quantity, and determining a second ratio of the product to a third velocity. The third ratio of speed; determine the second sine value of the fourth energy, determine the product of the second sine value and the fourth quantity, and determine the fourth ratio of the product to the fourth speed; determine the second cosine value of the fifth energy, determine the product of the second cosine value and the fifth quantity, and determine the fifth ratio of the product to the fifth speed; determine the sixth difference between the first ratio and the second ratio, determine the first sum of the sixth difference and the third ratio, determine the seventh difference between the first sum and the fourth ratio, and determine the second sum of the seventh difference and the fifth ratio; determine the absolute value of the second sum, and set the absolute value as a random number.

[0049] In this embodiment, a random number R is generated according to the following formula:

[0050]

[0051] Wherein, sinE1 is the sine value of energy E1 in the first target energy domain (i.e., the first sine value), sinE4 is the sine value of energy E4 in the fourth target energy domain (i.e., the second sine value), cosE2 is the cosine value of energy E2 in the second target energy domain (i.e., the first cosine value), cosE5 is the cosine value of energy E5 in the fifth target energy domain (i.e., the fifth cosine value), and tanE3 is the tangent value of energy E3 in the third target energy domain.

[0052] According to some preferred embodiments of this application, the method for generating random numbers further includes: if a particle moves from an initial target energy domain to an end target energy domain, the particle's velocity changes from the velocity of the particle in the initial target energy domain to the velocity of the particle in the end target energy domain, and the particle's mass changes from the mass of the particle in the initial target energy domain to the mass of the particle in the end target energy domain.

[0053] Because the particles undergo random and irregular thermal motion in each target energy domain, there is an exchange of particles between the domains. In some preferred embodiments, when a particle enters a different target energy domain, its velocity and mass are simultaneously changed. For example, when a particle moves from the first target energy domain (i.e., the initial target energy domain) to the second target energy domain (i.e., the final target energy domain), its velocity changes from V1 to V2, and its mass changes from m1 to m2. Therefore, the random numbers generated in this embodiment are guaranteed to be unique at any given time.

[0054] According to an optional embodiment of this application, the method for generating random numbers further includes: determining a time period, initializing the parameters of each target energy domain within the time period, and generating random numbers, wherein the random numbers generated within each time period are unique true random numbers.

[0055] In this embodiment, an update period is set for the algorithm for generating random numbers to periodically reinitialize the distribution of particles in each target energy domain. In each update period, the parameters of each target energy domain are reinitialized. Each time initialization is performed, the initial mass of the particles in each target energy domain remains unchanged, and the initial velocity of the particles in each target energy domain remains unchanged.

[0056] According to other preferred embodiments of this application, after generating random numbers based on the movement speed of particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain, the method further includes at least one of the following: adding different random numbers to different programs; adding random numbers to keys used for file encryption and decryption, or to parameter keys used for system interaction.

[0057] In other preferred embodiments, the random numbers generated by the method according to the embodiments of this application are applied in the following scenarios: when two programs interact, the random numbers are used as the interaction work order number to ensure the uniqueness of the work order number; when encrypting / decrypting files, multiple random numbers are concatenated or a single random number is used as the key for the file encryption / decryption process; or as a signature for transmitted files in a project; or as a system interaction parameter key during system interaction. The random numbers generated by the method according to the embodiments of this application are also applied to the primary key generation strategy, concatenating multiple random numbers into a primary key, or using a single random number as the primary key, ensuring the uniqueness of the primary key and ensuring data security.

[0058] Figure 3 This is a structural diagram of a random number generation device according to an embodiment of this application, such as... Figure 3As shown, it includes: an initialization module 30, used to determine multiple target energy domains and initialize the parameters of each target energy domain, wherein the target energy domain is the region where the particles move, and the parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the mass of the particles in each target energy domain; a first determination module 32, used to collect particles in each target energy domain and determine the number of particles collected in each target energy domain; a second determination module 34, used to determine the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the mass of the particles in each target energy domain; and a third determination module 36, used to generate random numbers based on the velocity of the particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0059] Figure 4 This is a flowchart for generating random numbers, such as... Figure 4 As shown, the random number generation device starts working, and initializes each target energy domain through the initialization module 30. The initial velocity (V) of the particles in energy domain 1 to energy domain 5 is initialized to 5, and the initial mass (M) of the particles in energy domain 1 to energy domain 5 is initialized to 10. The number of particles is randomly assigned to each energy domain. For example, 9000-10000 particles are assigned to energy domain 1, 7000-8000 particles to energy domain 2, 5000-6000 particles to energy domain 3, 2000-4000 particles to energy domain 4, and 1000-2000 particles to energy domain 5. The first determining module 32 collects particles from the five energy domains at a certain moment, obtains the number of particles in each energy domain at the time of collection, and records it; the number of particles in energy domain one is recorded as N1, the number of particles in energy domain two as N2, the number of particles in energy domain three as N3, the number of particles in energy domain four as N4, and the number of particles in energy domain five as N5. Assuming that the mass of the particles changes during motion, the second determining module 34 determines the moving mass m1 of the particles in energy domain one, the moving mass m2 of the particles in energy domain two, the moving mass m3 of the particles in energy domain three, the moving mass m4 of the particles in energy domain one, and the moving mass m5 of the particles in energy domain five, and determines the energy E1 of energy domain one, the energy E2 of energy domain two, the energy E3 of energy domain three, the energy E4 of energy domain four, and the energy E5 of energy domain five according to the formula E = (Mm) * N. The third determining module 36, based on the above information and the formula... Generate a random number and apply it to the target program or system.

[0060] It should be noted that, Figure 3 Preferred embodiments of the shown examples can be found in [reference needed]. Figure 2 The relevant descriptions of the embodiments shown will not be repeated here.

[0061] According to the method provided in the embodiments of this application, a lightweight random number generation strategy is provided; the generated random numbers have multiple excellent characteristics such as uniqueness, timeliness, randomness, and security.

[0062] This application also provides a non-volatile storage medium storing a program, wherein the program, when running, controls the device where the non-volatile storage medium is located to execute the above-mentioned random number generation method.

[0063] The aforementioned non-volatile storage medium is used to store a program that performs the following functions: determining multiple target energy domains, initializing the parameters of each target energy domain, wherein the target energy domain is the region where the particles move, and the parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain; collecting particles in each target energy domain and determining the number of particles collected in each target energy domain; determining the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain; and generating random numbers based on the velocity of the particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0064] This application also provides an electronic device, including a memory and a processor, the processor being used to run a program stored in the memory, wherein the program executes the above-described method for generating random numbers during runtime.

[0065] The processor in the aforementioned electronic device is used to run a program that performs the following functions: determining multiple target energy domains, initializing the parameters of each target energy domain, wherein the target energy domain is the region where the particles move, and the parameters include: the velocity of the particles in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain; collecting particles in each target energy domain and determining the number of particles collected in each target energy domain; determining the energy of each target energy domain based on the number of particles collected in each target energy domain, the initial mass of the particles in each target energy domain, and the moving mass of the particles in each target energy domain; and generating random numbers based on the velocity of the particles in each target energy domain, the number of particles collected in each target energy domain, and the energy of each target energy domain.

[0066] It should be noted that each module in the above-mentioned random number generation device can be a program module (for example, a set of program instructions that implement a certain function) or a hardware module. For the latter, it can be manifested in the following forms, but is not limited to them: each of the above modules is manifested as a processor, or the functions of each of the above modules are implemented by a processor.

[0067] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0068] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0069] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0070] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0071] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0072] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0073] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of generating a random number, characterized by, The method comprises the following steps: determining a plurality of target energy domains, and initializing parameters of each target energy domain in the plurality of target energy domains, wherein the target energy domain is a region of particle motion, and the parameters include: a motion speed of particles in each target energy domain, an initial mass of particles in each target energy domain, and a motion mass of particles in each target energy domain; collecting particles in each target energy domain respectively, and determining the number of collected particles in each target energy domain; determining the energy of each target energy domain according to the number of collected particles in each target energy domain, the initial mass of particles in each target energy domain, and the motion mass of particles in each target energy domain; generating random numbers according to the motion speed of particles in each target energy domain, the number of collected particles in each target energy domain, and the energy of each target energy domain.

2. The method of claim 1, wherein, The step of initializing the parameters of each target energy domain in the plurality of target energy domains comprises the following steps: determining a first target energy domain, initializing the motion speed of particles in the first target energy domain as a first speed, initializing the initial mass of particles in the first target energy domain as a first mass, and initializing the motion mass of particles in the first target energy domain as a second mass; determining a second target energy domain, initializing the motion speed of particles in the second target energy domain as a second speed, initializing the initial mass of particles in the second target energy domain as the first mass, and initializing the motion mass of particles in the second target energy domain as a third mass; determining a third target energy domain, initializing the motion speed of particles in the third target energy domain as a third speed, initializing the initial mass of particles in the third target energy domain as the first mass, and initializing the motion mass of particles in the third target energy domain as a fourth mass; determining a fourth target energy domain, initializing the motion speed of particles in the fourth target energy domain as a fourth speed, initializing the initial mass of particles in the fourth target energy domain as the first mass, and initializing the motion mass of particles in the fourth target energy domain as a fifth mass; determining a fifth target energy domain, initializing the motion speed of particles in the fifth target energy domain as a fifth speed, initializing the initial mass of particles in the fifth target energy domain as the first mass, and initializing the motion mass of particles in the fifth target energy domain as a sixth mass; The temperature of the first target energy domain is greater than the temperature of the second target energy domain, the temperature of the second target energy domain is greater than the temperature of the third target energy domain, the temperature of the third target energy domain is greater than the temperature of the fourth target energy domain, and the temperature of the fourth target energy domain is greater than the temperature of the fifth target energy domain; the first speed is greater than the second speed, the second speed is greater than the third speed, the third speed is greater than the fourth speed, and the fourth speed is greater than the fifth speed; the second mass is less than the third mass, the third mass is less than the fourth mass, the fourth mass is less than the fifth mass, the fifth mass is less than the sixth mass, and the sixth mass is less than the first mass.

3. The method of claim 2, wherein, According to the number of particles collected in each of the target energy domains, the initial mass of particles in each of the target energy domains, and the moving mass of particles in each of the target energy domains, the energy of each of the target energy domains is determined, including: determining a first difference value between the first mass and the second mass; determining a first product of the first difference value, a first number, and a preset value, and determining the first product as a first energy of the first target energy domain, wherein the first number is the number of particles collected in the first target energy domain; determining a second difference value between the first mass and the third mass; determining a second product of the second difference value, a second number, and the preset value, and determining the second product as a second energy of the second target energy domain, wherein the second number is the number of particles collected in the second target energy domain; determining a third difference value between the first mass and the fourth mass; determining a third product of the third difference value, a third number, and the preset value, and determining the third product as a third energy of the third target energy domain, wherein the third number is the number of particles collected in the third target energy domain; determining a fourth difference value between the first mass and the fifth mass; determining a fourth product of the fourth difference value, a fourth number, and the preset value, and determining the fourth product as a fourth energy of the fourth target energy domain, wherein the fourth number is the number of particles collected in the fourth target energy domain; determining a fifth difference value between the first mass and the sixth mass; determining a fifth product of the fifth difference value, a fifth number, and the preset value, and determining the fifth product as a fifth energy of the fifth target energy domain, wherein the fifth number is the number of particles collected in the first target energy domain.

4. The method of claim 3, wherein, According to the moving speed of particles in each of the target energy domains, the number of particles collected in each of the target energy domains, and the energy of each of the target energy domains, a random number is generated, including: determining a first sine value of the first energy, determining a product of the first sine value and the first number, and determining a first ratio of the product and the first speed; determining a first cosine value of the second energy, determining a product of the first cosine value and the second number, and determining a second ratio of the product and the second speed; determining a third sine value of the third energy, determining a product of the third sine value and the third number, and determining a third ratio of the product and the third speed; determining a fourth sine value of the fourth energy, determining a product of the fourth sine value and the fourth number, and determining a fourth ratio of the product and the fourth speed; determining a fifth sine value of the fifth energy, determining a product of the fifth sine value and the fifth number, and determining a fifth ratio of the product and the fifth speed. determining a tangent value of the third energy, determining a product of the tangent value and the third quantity, and determining a third ratio of the product to the third velocity; determining a second sine value of the fourth energy, determining a product of the second sine value and the fourth quantity, and determining a fourth ratio of the product to the fourth velocity; determining a second cosine value of the fifth energy, determining a product of the second cosine value and the fifth quantity, and determining a fifth ratio of the product to the fifth velocity; determining a sixth difference value of the first ratio and the second ratio, determining a first sum value of the sixth difference value and the third ratio, determining a seventh difference value of the first sum value and the fourth ratio, and determining a second sum value of the seventh difference value and the fifth ratio; determining an absolute value of the second sum value, and determining the absolute value as the random number.

5. The random number generation method of claim 1, wherein The method further comprises: if a micro-particle moves from an initial target energy domain to a terminal target energy domain, a moving speed of the micro-particle is changed from a moving speed of the micro-particle in the initial target energy domain to a moving speed of the micro-particle in the terminal target energy domain, and a moving mass of the micro-particle is changed from a moving mass of the micro-particle in the initial target energy domain to a moving mass of the micro-particle in the terminal target energy domain.

6. The method of claim 1, wherein, The method further comprises: determining a time period, initializing parameters of each of the target energy domains and generating the random number in the time period, wherein the random number generated in each of the time periods is a unique true random number.

7. The method of claim 1, wherein, After generating the random number according to the moving speed of the micro-particle in each of the target energy domains, the number of the micro-particles collected in each of the target energy domains and the energy of each of the target energy domains, the method further comprises at least one of the following: adding different random numbers to different programs; adding the random number to a key for implementing file encryption and decryption, or a parameter key for implementing system interaction.

8. An apparatus for generating a random number, characterized by comprising: comprise: an initialization module, configured to determine a plurality of target energy domains, and initialize parameters of each of the target energy domains, wherein the target energy domain is a region of movement of a micro-particle, and the parameters comprise a moving speed of the micro-particle in each of the target energy domains, an initial mass of the micro-particle in each of the target energy domains and a moving mass of the micro-particle in each of the target energy domains; a first determination module, configured to collect micro-particles in each of the target energy domains, and determine a number of the micro-particles collected in each of the target energy domains; a second determination module, configured to determine energy of each of the target energy domains according to the number of the micro-particles collected in each of the target energy domains, the initial mass of the micro-particle in each of the target energy domains and the moving mass of the micro-particle in each of the target energy domains; a third determination module, configured to generate a random number according to the moving speed of the micro-particle in each of the target energy domains, the number of the micro-particles collected in each of the target energy domains and the energy of each of the target energy domains.

9. A non-volatile storage medium, comprising: The non-volatile storage medium stores a program, wherein the program controls a device in which the non-volatile storage medium is located to perform the random number generation method in any one of claims 1 to 7 when the program is executed.

10. An electronic device, comprising: comprise: A memory and a processor for running a program stored in the memory, wherein the program, when running, implements the random number generation method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Quantum true random number SOC chip and device

    CN113986198A

  • Random number generating unit and computing system

    WO2021002115A1