Random number generation method and apparatus, and electronic device

By obtaining photon distribution data and randomly determining regions in a double-slit interference experiment, integer random numbers are generated, solving the problem of predictability of random numbers in existing technologies and improving the unpredictability and security of random numbers.

CN115357217BActive Publication Date: 2026-05-19CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2022-07-22
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

The random numbers generated in existing technologies are predictable, posing a security risk, especially in applications with high security requirements.

Method used

By acquiring photon distribution data on the screen in the double-slit interference experiment, N regions within the screen are randomly determined, and integer random numbers are generated based on the number of photons. By utilizing the particle nature of photons and the randomness of regions, unpredictable random numbers are generated.

Benefits of technology

It improves the unpredictability of generated random numbers, solves the security risks of random numbers in application areas with high security requirements, and enhances security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357217B_ABST
    Figure CN115357217B_ABST
Patent Text Reader

Abstract

The application discloses a random number generation method and device, and belongs to the technical field of computers. The method comprises the following steps: acquiring the bit number N of an integer random number to be generated, wherein N is a natural number greater than 1; acquiring photon distribution data on a screen in a double-slit interference experiment; randomly determining N regions in the screen corresponding to the photon distribution data; acquiring the number of photons received by the screen in each region based on the photon distribution data; and determining the value of a digit of the integer random number according to the number of photons received by the screen in each region, thereby obtaining the integer random number. The method improves the unpredictability of the generated random number by combining the uncertainty of the photon distribution data on the screen in the double-slit interference experiment and the random determination of the regions in the screen, thereby solving the problem of security risks in the use of random numbers in some random number application fields with high security requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to random number generation methods, apparatus, electronic devices, and computer-readable storage media. Background Technology

[0002] Random numbers are randomly generated sequences of one or more digits, and they have wide applications in various fields of life, such as serving as dynamic passwords, generating encryption keys, and performing authentication. Common random number generation methods in existing technologies include static random number generation using `Math.random()` and random number generation methods using the `java.util.Random` utility class. However, existing methods generate pseudo-random numbers, which are predictable. This poses security risks in applications with high security requirements.

[0003] It is evident that the random numbers generated by the methods used in existing technologies are predictable, posing security risks in certain application scenarios. Summary of the Invention

[0004] This application provides a random number generation method, apparatus, and electronic device to address the problem that the generated random numbers are predictable, posing security risks in certain applications with high security requirements.

[0005] In a first aspect, embodiments of this application provide a random number generation method, including:

[0006] Get the number of digits N of the random integer to be generated, where N is a natural number greater than 1;

[0007] To obtain photon distribution data on the screen during a double-slit interference experiment;

[0008] Randomly determine N regions within the screen corresponding to the photon distribution data;

[0009] Based on the photon distribution data, the number of photons received by the light screen in each of the regions is obtained;

[0010] Based on the number of photons received by the screen in each region, the value of one digit of the integer random number is determined to obtain the integer random number.

[0011] In some embodiments of this application, the step of determining the value of a digit of the integer random number based on the number of photons received by the screen in each region, to obtain the integer random number, includes:

[0012] Divide the number of photons received by the light screen in each region by 10, take the remainder, and obtain N natural numbers;

[0013] The obtained N natural numbers are randomly arranged to obtain a random number sequence;

[0014] In response to the first digit of the random number sequence being a non-zero natural number, the random integer number is generated according to the order of the natural numbers in the random number sequence.

[0015] In some embodiments of this application, after randomly arranging the obtained N natural numbers less than 10 to obtain a random number sequence, the method further includes:

[0016] In response to the first digit of the random number sequence being zero, the process jumps to the step of randomly arranging the N natural numbers less than 10 to obtain the random number sequence.

[0017] In some embodiments of this application, the photon distribution data includes: the size of the screen represented by the photon receiving unit, and the number of photons received by each of the photon receiving units in the screen. The step of randomly determining N regions within the screen corresponding to the photon distribution data includes:

[0018] Determine the target region in the optical screen corresponding to the photon distribution data, wherein the target region is: the region in the optical screen obtained by shrinking each boundary of the optical screen inward by at least N of the photon receiving units;

[0019] A first position is randomly determined in the target area, and a second position is randomly determined in the light screen;

[0020] N circular regions of different sizes on the screen are identified with the first position as the center, and the circumference of the largest circular region among the N circular regions passes through the second position;

[0021] The smallest circular region among the N circular regions, and the N-1 non-overlapping annular regions formed by the N circular regions, are taken as the N regions within the screen corresponding to the photon distribution data.

[0022] In some embodiments of this application, before the step of obtaining the photon distribution data on the screen in the double-slit interference experiment, the method further includes:

[0023] Pre-store multiple sets of photon distribution data on the screen at different durations during the double-slit interference experiment;

[0024] The acquisition of photon distribution data on the screen during the double-slit interference experiment includes:

[0025] From the stored multiple sets of photon distribution data, a set of photon distribution data is randomly selected.

[0026] Secondly, embodiments of this application provide a random number generation apparatus, comprising:

[0027] The random number bit depth module is used to obtain the number of bits N of the random integer to be generated, where N is a natural number greater than 1;

[0028] The photon distribution data acquisition module is used to acquire photon distribution data on the screen during the double-slit interference experiment.

[0029] The region acquisition module in the light screen is used to randomly determine N regions within the light screen corresponding to the photon distribution data;

[0030] The regional photon count acquisition module is used to acquire the number of photons received by the light screen in each region based on the photon distribution data.

[0031] The random number generation module is used to determine the value of one digit of the integer random number based on the number of photons received by the light screen in each area, thereby obtaining the integer random number.

[0032] In some embodiments of this application, the random number generation module is further configured to:

[0033] Divide the number of photons received by the light screen in each region by 10, take the remainder, and obtain N natural numbers;

[0034] The obtained N natural numbers are randomly arranged to obtain a random number sequence;

[0035] In response to the first digit of the random number sequence being a non-zero natural number, the random integer number is generated according to the order of the natural numbers in the random number sequence.

[0036] In some embodiments of this application, the random number generation module is further configured to:

[0037] In response to the first digit of the random number sequence being zero, the process jumps to the random arrangement of the N natural numbers less than 10 to obtain the random number sequence.

[0038] In some embodiments of this application, the photon distribution data includes: the size of the screen represented by the photon receiving unit, and the number of photons received by each of the photon receiving units in the screen. The region acquisition module in the screen is further used for:

[0039] Determine the target region in the optical screen corresponding to the photon distribution data, wherein the target region is: the region in the optical screen obtained by shrinking each boundary of the optical screen inward by at least N of the photon receiving units;

[0040] A first position is randomly determined in the target area, and a second position is randomly determined in the light screen;

[0041] N circular regions of different sizes on the screen are identified with the first position as the center, and the circumference of the largest circular region among the N circular regions passes through the second position;

[0042] The smallest circular region among the N circular regions, and the N-1 non-overlapping annular regions formed by the N circular regions, are taken as the N regions within the screen corresponding to the photon distribution data.

[0043] In some embodiments of this application, before acquiring the photon distribution data on the screen in the double-slit interference experiment, the following steps are included:

[0044] Pre-store multiple sets of photon distribution data on the screen at different durations during the double-slit interference experiment;

[0045] Accordingly, the photon distribution data acquisition module is further used for:

[0046] From the stored multiple sets of photon distribution data, a set of photon distribution data is randomly selected.

[0047] Thirdly, embodiments of this application also disclose an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the random number generation method described in embodiments of this application.

[0048] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs the steps of the random number generation method disclosed in embodiments of this application.

[0049] The random number generation method disclosed in this application involves obtaining the number of digits N of the integer random number to be generated, where N is a natural number greater than 1; obtaining photon distribution data on a screen during a double-slit interference experiment; randomly determining N regions within the screen corresponding to the photon distribution data; obtaining the number of photons received by the screen in each region based on the photon distribution data; and determining the value of one digit of the integer random number based on the number of photons received by the screen in each region to obtain the integer random number. This method helps improve the unpredictability of the generated random number, thereby solving the security risks associated with using random numbers in certain applications with high security requirements.

[0050] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0051] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] Figure 1 This is a flowchart of a random number generation method in one embodiment of this application;

[0053] Figure 2 This is a schematic diagram illustrating the effect of N regions defined in a light screen in one embodiment of this application;

[0054] Figure 3 This is a schematic diagram of the random number generation device structure in one embodiment of this application;

[0055] Figure 4 A block diagram schematically illustrates an electronic device for performing the method according to this application; and

[0056] Figure 5 A storage unit for holding or carrying program code implementing the method according to this application is illustrated schematically. Detailed Implementation

[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] like Figure 1 As shown in the embodiment of this application, a random number generation method is disclosed, including steps 110 to 150.

[0059] Step 110: Obtain the number of digits N of the random integer to be generated, where N is a natural number greater than 1.

[0060] The random number generation method described in this application is applied to generating random integer numbers, such as generating thousands-digit numbers or tens-of-thousands-digit numbers. In specific implementations, the random number generation method disclosed in this application can be encapsulated into a development package and its interface exposed for other applications to call; alternatively, the random number generation method disclosed in this application can be deployed as a server-side application to a cloud platform, allowing clients to call corresponding services through the exposed interface. In other embodiments of this application, the random number generation method disclosed in this application can also be executed in other ways, which will not be listed individually in this application.

[0061] When executing the random number generation method disclosed in this application, the number of digits of the random number to be generated must first be input. After obtaining the number of digits of the random number to be generated, the random number generation method disclosed in this application performs subsequent random number generation operations based on the number of digits. The number of digits of the random number to be generated is greater than 1.

[0062] Taking a random number to be generated as an example where the number is in the thousands place, the number of digits N in the random integer to be generated is 4; taking a random number to be generated as an example where the number is in the ten-thousands place, the number of digits N in the random integer to be generated is 5.

[0063] Step 120: Obtain photon distribution data on the screen during the double-slit interference experiment.

[0064] In the embodiments of this application, based on the randomness of the distribution of light particles projected onto the screen in the double-slit interference experiment, and combined with obtaining the number of photons projected in a randomly determined area in the screen, a random number is determined, thereby achieving the purpose of determining a true random number.

[0065] In scientific research, teaching experiments, and other fields, the double-slit interference experiment is already easily implemented. The double-slit interference experiment can be performed using a double-slit interference experimental setup, and then photon counting techniques (such as photon counters or photoelectric conversion devices) can be used to count the photons projected onto the screen in real time, thereby determining the number of photons projected into the photon receiving unit on the screen. The photon receiving unit can be the area on the screen counted by the photon counter, or the area on the screen detected by each photoelectric conversion device.

[0066] For a specific example, a screen can be constructed using several photoelectric conversion devices arranged in a vertical and horizontal pattern. When photons are projected onto the screen through a double slit, the photoelectric conversion devices at the projection positions will generate corresponding currents upon receiving the photons, thus enabling photon counting. As the duration of the double-slit interference experiment increases, the number of photons projected onto the screen increases, and the photoelectric conversion devices at different positions on the screen will count from 0 to several photons. This allows us to obtain the number of photons received by each photon receiving unit on the screen at a given moment. Subsequently, based on the number of photoelectric conversion devices on the screen and the number of photons received by the photon receiving unit corresponding to each photoelectric conversion device, the photon distribution data on the screen at a given moment can be obtained.

[0067] In the embodiments of this application, in order to save the implementation cost of this method, existing photon distribution data obtained by researchers through double-slit interference experiments can also be used.

[0068] In practice, other methods can also be used to generate photon distribution data based on the results of the double-slit interference experiment. This application does not limit the specific implementation of the photon distribution data generated based on the results of the double-slit interference experiment.

[0069] In some embodiments of this application, the photon distribution data includes: the size of the screen represented by the photon receiving units, and the number of photons received by each photon receiving unit (such as the aforementioned photoelectric conversion device) in the screen. For example, for a screen comprising I×J photon receiving units (such as an array of photoelectric conversion devices), the size of the screen can be represented as I×J, and the photon distribution data can be represented as an I×J matrix, where each matrix element corresponds to the number of photons received by the photon receiving unit at the corresponding position. Here, I and J are positive integers.

[0070] In the embodiments of this application, before the step of obtaining the photon distribution data on the screen during the double-slit interference experiment, the method includes: pre-storing multiple sets of photon distribution data on the screen for different durations of the double-slit interference experiment. The longer the execution duration of the double-slit interference experiment, the more photons are projected onto the screen, and the corresponding photon distribution data changes with the execution duration of the double-slit interference experiment.

[0071] Accordingly, obtaining the photon distribution data on the screen in the double-slit interference experiment includes: randomly selecting a set of photon distribution data from the stored multiple sets of photon distribution data. By randomly selecting a set of photon distribution data from multiple sets of photon distribution data to generate random numbers, the unpredictability of the random numbers can be further enhanced.

[0072] Step 130: Randomly determine N regions within the screen corresponding to the photon distribution data.

[0073] Next, N regions within the screen corresponding to the photon distribution data are further determined. In the embodiments of this application, N non-overlapping regions are randomly determined within the screen corresponding to the photon distribution data. These regions can be regular or irregular. The N regions can be of the same size or different sizes. Preferably, the N regions are of different sizes to further enhance the unpredictability of the random numbers.

[0074] Step 140: Based on the photon distribution data, obtain the number of photons received by the light screen in each region.

[0075] In some embodiments of this application, a virtual light screen image can be generated based on the photon distribution data. The number of photons received by each photon receiving unit is used as the pixel value of the corresponding pixel in the virtual light screen image. Then, N regions are randomly determined on the virtual light screen image, and these N regions correspond one-to-one with N regions on the light screen. Furthermore, for each region in the virtual light screen image, the total number of photons received in the corresponding region of the light screen can be obtained by summing the pixel values ​​of all pixels in that region.

[0076] In some other embodiments of this application, the sum of the number of photons received by all light spot receiving units corresponding to the corresponding area in the light screen can be directly counted as the number of photons received by the light screen in that area.

[0077] Step 150: Based on the number of photons received by the light screen in each area, determine the value of one digit of the integer random number to obtain the integer random number.

[0078] Next, based on the number of photons in each region determined in the preceding steps, the digit of one place value in the random number to be generated is determined, thereby obtaining the random integer number to be generated.

[0079] In some embodiments of this application, the step of determining the value of a digit of the integer random number based on the number of photons received by the screen in each region to obtain the integer random number includes: dividing the number of photons received by the screen in each region by 10 and taking the remainder to obtain N natural numbers; randomly arranging the N natural numbers to obtain a random number sequence; and generating the integer random number according to the order of the natural numbers in the random number sequence, in response to the first digit of the random number sequence being a non-zero natural number.

[0080] For an integer, each digit can be any number between 0, 1, 2, ..., 9. The number of photons received in each region of the screen can be 0, tens of thousands, or even more. In embodiments of this application, the units digit of the number of photons received in each region of the screen is taken as the value of one digit of the random integer to be generated. Thus, based on the number of photons received in N regions of the screen, N values ​​can be obtained. In some embodiments of this application, for a certain region of the screen, a natural number between 0 and 9 can be obtained by dividing the number of photons received in that region by 10 and taking the remainder. This unit digit is then used as the value of one digit of the random integer to be generated. For example, if a certain region of the screen receives 45 photons, then 5 is taken as the value of one digit of the random integer to be generated; if another region of the screen receives 100 photons, then 0 is taken as the value of the other digit of the random integer to be generated.

[0081] Next, the N values ​​are randomly arranged to obtain a random number sequence with N digits. For example, if the four generated values ​​are 0, 1, 2, and 3, randomly arranging these four values ​​can result in a random number sequence such as "0, 1, 2, 3", "2, 1, 3, 0", "1, 2, 4, 0", and so on.

[0082] In some embodiments of this application, since the random number to be generated is an integer random number, the first digit cannot be 0. For the generated random number sequence, it is necessary to further determine whether the first digit is 0. If the first digit of the random number sequence is not 0, the integer random number is generated according to the order of the natural numbers in the random number sequence. Taking the generated random number sequence "2, 1, 3, 0" as an example, the generated integer random number is 2130.

[0083] In some embodiments of this application, after randomly arranging the obtained N natural numbers less than 10 to obtain a random number sequence, the method further includes: in response to the first digit of the random number sequence being zero, jumping to the step of randomly arranging the obtained N natural numbers less than 10 to obtain a random number sequence. If the first digit of the random number sequence is 0, then it is necessary to randomly generate a new number sequence based on the N natural numbers determined in the aforementioned steps. Taking the generated random number sequence as "0, 1, 2, 3" as an example, it is necessary to jump to the step of randomly arranging the obtained N natural numbers less than 10 to obtain a random number sequence, and re-execute the step of randomly arranging the obtained N natural numbers less than 10 to obtain a random number sequence, until a random number sequence with a non-zero first digit is generated.

[0084] This completes all the steps for generating random integer numbers.

[0085] The following specific example further illustrates an implementation scheme for randomly determining N regions within a screen corresponding to the photon distribution data. The random determination of the N regions within the screen corresponding to the photon distribution data includes: determining a target region within the screen corresponding to the photon distribution data, wherein the target region is: a region within the screen obtained by shrinking each boundary of the screen inward by at least N photon receiving units; randomly determining a first position within the target region, and randomly determining a second position within the screen; determining N circular regions of different sizes on the screen centered at the first position, wherein the circumference of the largest circular region among the N circular regions passes through the second position; and selecting the smallest circular region among the N circular regions, and N-1 non-overlapping annular regions formed by the N circular regions, as the N regions within the screen corresponding to the photon distribution data.

[0086] Taking the screen size as I×J as an example, assuming each photon receiving unit in the screen corresponds to an area of ​​1 cm × 1 cm, then the screen is a photon receiving screen with a length of I cm and a width of J cm. If a 4-bit random integer needs to be generated, it is first necessary to determine the first boundary line 4 cm from the left boundary of the screen, the second boundary line 4 cm from the right boundary of the screen, the third boundary line 4 cm from the top boundary of the screen, and the fourth boundary line 4 cm from the bottom boundary of the screen. Then, the area (I-8) cm × (J-8) cm enclosed by the first, second, third, and fourth boundary lines is taken as the target area in the screen. Figure 2 Taking the screen 210 shown as an example, the target area is 220.

[0087] Next, a point is randomly selected within the target area 220 and designated as the first position (e.g., ...). Figure 2 The point “o” in the image is used to determine a second position (e.g., point “o” in the image). A second position is randomly selected within the screen 210 (including the target area 220). Figure 2 Using point "a" as the center and the distance between the first and second positions (e.g., the line segment "oa" between points "o" and "a") as the radius, a circle can be defined on the screen, such as circle 230. Then, within circle 230, construct three concentric circles, as shown below. Figure 2 The radii of circles 240, 250, and 260, and circles 230, 240, 250, and 260 are all different. For example... Figure 2 As shown, a circular region is formed inside circle 260, an annular region is formed between circles 250 and 260, an annular region is formed between circles 240 and 250, and an annular region is formed between circles 230 and 240. Following this method, four regions within the screen can be determined.

[0088] In some embodiments of this application, the radius of circle 230 is randomly determined. Furthermore, the radii of circles 240, 250, and 260 can be randomly determined to be different values, thereby further improving the unpredictability of the generated random numbers. For example, three points can be randomly determined on a radius (such as line segment oa) of circle 230, and then concentric circles 240, 250, and 260 of circle 230 can be drawn through these three points respectively.

[0089] In some other embodiments of this application, step 120 may be executed first, followed by step 110. This application does not limit the execution order of steps 110 and 120.

[0090] The random number generation method disclosed in this application involves obtaining the number of digits N of the integer random number to be generated, where N is a natural number greater than 1; obtaining photon distribution data on a screen during a double-slit interference experiment; randomly determining N regions within the screen corresponding to the photon distribution data; obtaining the number of photons received by the screen in each region based on the photon distribution data; and determining the value of one digit of the integer random number based on the number of photons received by the screen in each region to obtain the integer random number. This method helps improve the unpredictability of the generated random number, thereby solving the security risks associated with using random numbers in certain applications with high security requirements.

[0091] The random number generation method disclosed in this application improves the unpredictability of the generated random numbers by utilizing the uncertainty of the number of photons projected onto various regions of the screen in the double-slit interference experiment (i.e., the particle nature of light) and combining it with the randomness of selecting regions on the screen.

[0092] Furthermore, for N randomly obtained values, generating random integer numbers by randomly arranging them can further improve the unpredictability of the generated random numbers.

[0093] This application discloses a random number generation device, such as... Figure 3 As shown, the device includes:

[0094] The random number bit depth module 310 is used to obtain the number of bits N of the random integer to be generated, where N is a natural number greater than 1;

[0095] Photon distribution data acquisition module 320 is used to acquire photon distribution data on the screen during double-slit interference experiments;

[0096] The region acquisition module 330 in the light screen is used to randomly determine N regions within the light screen corresponding to the photon distribution data;

[0097] The regional photon count acquisition module 340 is used to acquire the number of photons received by the light screen in each region based on the photon distribution data.

[0098] The random number generation module 350 is used to determine the value of one digit of the integer random number based on the number of photons received by the light screen in each area, thereby obtaining the integer random number.

[0099] In some embodiments of this application, the random number generation module 350 is further configured to:

[0100] Divide the number of photons received by the light screen in each region by 10, take the remainder, and obtain N natural numbers;

[0101] The obtained N natural numbers are randomly arranged to obtain a random number sequence;

[0102] In response to the first digit of the random number sequence being a non-zero natural number, the random integer number is generated according to the order of the natural numbers in the random number sequence.

[0103] In some embodiments of this application, the random number generation module 350 is further configured to:

[0104] In response to the first digit of the random number sequence being zero, the process jumps to the step of randomly arranging the N natural numbers less than 10 to obtain the random number sequence.

[0105] In some embodiments of this application, the photon distribution data includes: the size of the screen represented by the photon receiving unit, and the number of photons received by each of the photon receiving units in the screen. The area acquisition module 330 in the screen is further used for:

[0106] Determine the target region in the optical screen corresponding to the photon distribution data, wherein the target region is: the region in the optical screen obtained by shrinking each boundary of the optical screen inward by at least N of the photon receiving units;

[0107] A first position is randomly determined in the target area, and a second position is randomly determined in the light screen;

[0108] N circular regions of different sizes on the screen are identified with the first position as the center, and the circumference of the largest circular region among the N circular regions passes through the second position;

[0109] The smallest circular region among the N circular regions, and the N-1 non-overlapping annular regions formed by the N circular regions, are taken as the N regions within the screen corresponding to the photon distribution data.

[0110] In some embodiments of this application, before acquiring the photon distribution data on the screen in the double-slit interference experiment, the following steps are included:

[0111] Pre-store multiple sets of photon distribution data on the screen at different durations during the double-slit interference experiment;

[0112] Accordingly, the photon distribution data acquisition module 320 is further configured to:

[0113] From the stored multiple sets of photon distribution data, a set of photon distribution data is randomly selected.

[0114] The random number generation apparatus disclosed in this application is used to implement the random number generation method described in this application. The specific implementation methods of each module of the apparatus will not be repeated here, but can be found in the specific implementation methods of the corresponding steps in the method embodiments.

[0115] The random number generation device disclosed in this application obtains the number of digits N of the integer random number to be generated, where N is a natural number greater than 1; obtains photon distribution data on a screen in a double-slit interference experiment; randomly determines N regions within the screen corresponding to the photon distribution data; based on the photon distribution data, obtains the number of photons received by the screen in each region; and determines the value of one digit of the integer random number according to the number of photons received by the screen in each region, thereby obtaining the integer random number. This helps to improve the unpredictability of the generated random number, thus solving the problem of security risks associated with the use of random numbers in certain application fields with high security requirements.

[0116] The random number generation device disclosed in this application improves the unpredictability of the generated random numbers by utilizing the uncertainty of the number of photons projected onto various regions of the screen in the double-slit interference experiment (i.e., the particle nature of light) and combining it with the randomness of selecting regions on the screen.

[0117] Furthermore, for N randomly obtained values, generating random integer numbers by randomly arranging them can further improve the unpredictability of the generated random numbers.

[0118] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus embodiments, since they are fundamentally similar to the method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0119] The above provides a detailed description of a random number generation method and apparatus provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method of this application and its core idea. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the idea of ​​this application. Therefore, the content of this specification should not be construed as a limitation of this application.

[0120] The device embodiments described above are merely illustrative. 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 network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0121] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the electronic device according to the embodiments of this application. This application can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0122] For example, Figure 4 An electronic device is shown that can implement the methods according to this application. The electronic device may be a PC, mobile terminal, personal digital assistant, tablet computer, etc. The electronic device conventionally includes a processor 410 and a memory 420, and program code 430 stored in the memory 420 and executable on the processor 410, which, when executing the program code 430, implements the methods described in the above embodiments. The memory 420 may be a computer program product or a computer-readable medium. The memory 420 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. The memory 420 has a storage space 4201 for the program code 430 of a computer program for performing any of the method steps described above. For example, the storage space 4201 for the program code 430 may include various computer programs for implementing the various steps in the above methods. The program code 430 is computer-readable code. These computer programs can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, CDs, memory cards, or floppy disks. The computer program includes computer-readable code that, when executed on an electronic device, causes the electronic device to perform the method according to the above embodiments.

[0123] This application also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the random number generation method as described in this application.

[0124] Such a computer program product can be a computer-readable storage medium, which can have the same characteristics as... Figure 4 The memory 420 in the illustrated electronic device is similarly arranged with storage segments, storage spaces, etc. Program code can be stored, for example, in a compressed form on the computer-readable storage medium. The computer-readable storage medium is typically as shown in the reference... Figure 5 The portable or fixed storage unit is described above. Typically, the storage unit includes computer-readable code 430', which is code read by a processor and, when executed by the processor, implements the various steps in the method described above.

[0125] The terms "an embodiment," "embodiment," or "one or more embodiments" as used herein mean that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of this application. Furthermore, please note that the examples of the phrase "in one embodiment" do not necessarily all refer to the same embodiment.

[0126] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0127] In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for generating random numbers, characterized in that, include: Get the number of digits N of the random integer to be generated, where N is a natural number greater than 1; To obtain photon distribution data on the screen during a double-slit interference experiment; Randomly determine N regions within the screen corresponding to the photon distribution data; Based on the photon distribution data, the number of photons received by the light screen in each of the regions is obtained; Based on the number of photons received by the light screen in each area, the value of one digit of the integer random number is determined to obtain the integer random number; The step of determining the value of a digit of the integer random number based on the number of photons received by the light screen in each region, to obtain the integer random number, includes: Divide the number of photons received by the light screen in each region by 10, take the remainder, and obtain N natural numbers; The obtained N natural numbers are randomly arranged to obtain a random number sequence; In response to the first digit of the random number sequence being a non-zero natural number, the random integer number is generated according to the order of the natural numbers in the random number sequence.

2. The method according to claim 1, characterized in that, After randomly arranging the N natural numbers less than 10 to obtain a random number sequence, the following steps are also included: In response to the first digit of the random number sequence being zero, the process jumps to the step of randomly arranging the N natural numbers less than 10 to obtain the random number sequence.

3. The method according to claim 1 or 2, characterized in that, The photon distribution data includes: the size of the screen represented by the photon receiving unit, and the number of photons received by each of the photon receiving units in the screen. The random determination of N regions within the screen corresponding to the photon distribution data includes: Determine the target region in the optical screen corresponding to the photon distribution data, wherein the target region is: the region in the optical screen obtained by shrinking each boundary of the optical screen inward by at least N of the photon receiving units; A first position is randomly determined in the target area, and a second position is randomly determined in the light screen; N circular regions of different sizes on the screen are identified with the first position as the center, and the circumference of the largest circular region among the N circular regions passes through the second position; The smallest circular region among the N circular regions, and the N-1 non-overlapping annular regions formed by the N circular regions, are taken as the N regions within the screen corresponding to the photon distribution data.

4. The method according to claim 1 or 2, characterized in that, Before the step of acquiring photon distribution data on the screen in the double-slit interference experiment, the following steps are included: Pre-store multiple sets of photon distribution data on the screen at different durations during the double-slit interference experiment; The acquisition of photon distribution data on the screen during the double-slit interference experiment includes: From the stored multiple sets of photon distribution data, a set of photon distribution data is randomly selected.

5. A random number generation device, characterized in that, include: The random number bit depth module is used to obtain the number of bits N of the random integer to be generated, where N is a natural number greater than 1; The photon distribution data acquisition module is used to acquire photon distribution data on the screen during the double-slit interference experiment. The region acquisition module in the light screen is used to randomly determine N regions within the light screen corresponding to the photon distribution data; The regional photon count acquisition module is used to acquire the number of photons received by the screen in each region based on the photon distribution data. A random number generation module is used to determine the value of one digit of the integer random number based on the number of photons received by the light screen in each area, thereby obtaining the integer random number; The random number generation module is further used for: Divide the number of photons received by the light screen in each region by 10, take the remainder, and obtain N natural numbers; The obtained N natural numbers are randomly arranged to obtain a random number sequence; In response to the first digit of the random number sequence being a non-zero natural number, the random integer number is generated according to the order of the natural numbers in the random number sequence.

6. The apparatus according to claim 5, characterized in that, The random number generation module is also used for: In response to the first digit of the random number sequence being zero, the process jumps to randomly arranging the resulting N natural numbers less than 10 to obtain a random number sequence.

7. An electronic device, comprising a memory, a processor, and program code stored in the memory and executable on the processor, characterized in that, When the processor executes the program code, it implements the random number generation method according to any one of claims 1 to 4.

8. A computer-readable storage medium having program code stored thereon, characterized in that, When the program code is executed by the processor, it implements the steps of the random number generation method according to any one of claims 1 to 4.