A random number generation method, device, electronic equipment and storage medium
By obtaining solar spectral information, calculating intermediate values, and recombining numbers to generate random numbers, the problem of the single random number generation method in the existing technology is solved, and high randomness and security of random numbers are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD
- Filing Date
- 2022-08-11
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for generating random numbers are relatively simple, and their randomness, security, and uniqueness need to be improved.
By acquiring multiple sets of solar spectral information, calculating intermediate values using band spectral information, and selecting numbers from them according to preset positioning rules to recombine and generate random numbers.
It improves the randomness, security, and uniqueness of random numbers, making them difficult to copy and crack.
Smart Images

Figure CN115437604B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and more particularly to a method, apparatus, electronic device, and storage medium for generating random numbers. Background Technology
[0002] Random numbers are unpredictable sequences of numbers that conform to a specified distribution. They are needed in many scenarios. For example, during interaction between two programs, random numbers can be appended to the request sequence number to ensure its uniqueness. Similarly, random numbers can be used to update parameter keys in file encryption / decryption or system interaction scenarios, thus ensuring data security. Furthermore, during data persistence, random numbers can be added to the sequence to obtain a primary key identifier, greatly ensuring its uniqueness. However, current methods for generating random numbers are relatively limited, and the randomness, security, and uniqueness of the generated random numbers need improvement. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for generating random numbers, thereby addressing at least the problems in related technologies where random number generation methods are relatively limited and the randomness, security, and uniqueness of the generated random numbers need improvement. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, a random number generation method is provided, comprising:
[0005] Acquire multiple sets of solar spectral information, each set of solar spectral information including spectral information of multiple bands;
[0006] Based on the included spectral information of the bands, determine the median value corresponding to each group of solar spectral information;
[0007] According to the preset digit selection rules, at least one digit is selected from each intermediate value, and the selected digits are recombined to obtain the target random number.
[0008] Optionally, acquiring multiple sets of solar spectral information includes:
[0009] Randomly determine multiple locations and the corresponding time points for each location;
[0010] Collect solar spectral information for each location at the corresponding time point.
[0011] Optionally, each set of solar spectral information includes spectral information of nine bands, namely the first band spectral information, the second band spectral information, the third band spectral information, the fourth band spectral information, the fifth band spectral information, the sixth band spectral information, the seventh band spectral information, the eighth band spectral information, and the ninth band spectral information.
[0012] The step of determining the intermediate value corresponding to each group of solar spectral information based on the included band spectral information includes:
[0013] For any set of solar spectral information, the sum of the second band spectral information and the third band spectral information is determined, and the quotient of the first band spectral information and the sum is determined as the first parameter;
[0014] The product of the fourth band spectral information and the fifth band spectral information, the reciprocal of the cosine value of the sixth band spectral information, and the sine value of the seventh band spectral information are determined as the second parameter;
[0015] The product between the tangent of the eighth band spectral information and the ninth band spectral information is determined as the third parameter;
[0016] The sum of the first parameter, the second parameter, and the third parameter is determined as the intermediate value corresponding to any set of solar spectral information.
[0017] Optionally, the first spectral information corresponds to the red light band, the second spectral information corresponds to the orange light band, the third spectral information corresponds to the yellow light band, the fourth spectral information corresponds to the green light band, the fifth spectral information corresponds to the cyan light band, the sixth spectral information corresponds to the blue light band, the seventh spectral information corresponds to the violet light band, the eighth spectral information corresponds to the infrared light band, and the ninth spectral information corresponds to the ultraviolet light band.
[0018] Optionally, the position selection rule includes the position selection location, position selection length, position selection direction, and fill character corresponding to each intermediate value;
[0019] The step of selecting at least one digit from each intermediate value according to a preset digit selection rule, and then recombining the selected digits to obtain a target random number includes:
[0020] For any intermediate value, determine the number at the position of the intermediate value as the target number. If the length of the remaining numbers along the position direction is not less than the position length, select the number of the position length as the candidate value of the intermediate value. If the length of the remaining numbers along the position direction is less than the position length, use the padding character to pad the remaining numbers to obtain a string that meets the position length, which is then used as the candidate value of the intermediate value.
[0021] The candidate values are randomly recombined to obtain the target random number.
[0022] Optionally, the solar spectral information includes four sets, and the corresponding intermediate values are the first intermediate value, the second intermediate value, the third intermediate value, and the fourth intermediate value, respectively.
[0023] The first intermediate value corresponds to the half position, the position length is 3, the position direction is backward, and the padding character is 0;
[0024] The second intermediate value corresponds to a position at one-third of the way down, a position length of 1, a position direction of backwards, and a padding character of 2.
[0025] The third intermediate value corresponds to a quarter position, a position length of 2, a position direction of backward, and a fill character of f;
[0026] The fourth intermediate value corresponds to the starting position, the position length is 2, the position direction is backward, and the fill character is t.
[0027] According to a second aspect of the present disclosure, a random number generation apparatus is provided, comprising:
[0028] The acquisition unit is configured to acquire multiple sets of solar spectral information, each set of solar spectral information including band spectral information of multiple bands;
[0029] The determining unit is configured to perform the task of determining the intermediate value corresponding to each group of solar spectral information based on the included band spectral information.
[0030] The recombination unit is configured to perform a recombination operation, selecting at least one digit from each intermediate value according to a preset digit selection rule, and recombining the selected digits to obtain a target random number.
[0031] Optionally, the acquisition unit is configured to perform:
[0032] Randomly determine multiple locations and the corresponding time points for each location;
[0033] Collect solar spectral information for each location at the corresponding time point.
[0034] Optionally, each set of solar spectral information includes spectral information of nine bands, namely the first band spectral information, the second band spectral information, the third band spectral information, the fourth band spectral information, the fifth band spectral information, the sixth band spectral information, the seventh band spectral information, the eighth band spectral information, and the ninth band spectral information.
[0035] The determining unit is configured to perform the following operations for any set of solar spectral information: determine the sum of the second band spectral information and the third band spectral information; determine the quotient of the first band spectral information and the sum, as a first parameter; determine the product of the fourth band spectral information and the fifth band spectral information, the reciprocal of the cosine of the sixth band spectral information, and the sine of the seventh band spectral information, as a second parameter; determine the product of the tangent of the eighth band spectral information and the ninth band spectral information, as a third parameter; and determine the sum of the first parameter, the second parameter, and the third parameter as the intermediate value corresponding to the any set of solar spectral information.
[0036] Optionally, the first spectral information corresponds to the red light band, the second spectral information corresponds to the orange light band, the third spectral information corresponds to the yellow light band, the fourth spectral information corresponds to the green light band, the fifth spectral information corresponds to the cyan light band, the sixth spectral information corresponds to the blue light band, the seventh spectral information corresponds to the violet light band, the eighth spectral information corresponds to the infrared light band, and the ninth spectral information corresponds to the ultraviolet light band.
[0037] Optionally, the position selection rule includes the position selection location, position selection length, position selection direction, and fill character corresponding to each intermediate value;
[0038] The recombination unit is configured to, for any intermediate value, determine the number at the position of the intermediate value as the target number; if the length of the remaining numbers along the position direction is not less than the position length, select a number of the position length as a candidate value of the intermediate value; if the length of the remaining numbers along the position direction is less than the position length, fill the remaining numbers with the padding character to obtain a string that conforms to the position length as a candidate value of the intermediate value; and randomly recombine multiple candidate values to obtain a target random number.
[0039] Optionally, the solar spectral information includes four sets, with corresponding intermediate values being a first intermediate value, a second intermediate value, a third intermediate value, and a fourth intermediate value; the first intermediate value corresponds to a position at the halfway point, a position length of 3, a position direction of backward, and a fill character of 0; the second intermediate value corresponds to a position at the one-third point, a position length of 1, a position direction of backward, and a fill character of 2; the third intermediate value corresponds to a position at the one-quarter point, a position length of 2, a position direction of backward, and a fill character of f; the fourth intermediate value corresponds to a position at the starting point, a position length of 2, a position direction of backward, and a fill character of t.
[0040] According to a third aspect of the present disclosure, a random number generation electronic device is provided, comprising:
[0041] processor;
[0042] Memory used to store the processor's executable instructions;
[0043] The processor is configured to execute the instructions to implement the random number generation method described in any one of the claims.
[0044] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided such that, when instructions in the computer-readable storage medium are executed by a processor of a random number generating electronic device, the random number generating electronic device is able to perform the random number generation method described in any one of the present claims.
[0045] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the random number generation method described in any one of the present claims.
[0046] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0047] Acquire multiple sets of solar spectral information, each set including band spectral information of multiple spectral bands; determine the median value corresponding to each set of solar spectral information based on the included band spectral information; select at least one digit from each median value according to a preset digit selection rule, and recombine the selected digits to obtain the target random number.
[0048] In this way, a highly random computational model is constructed using the ever-changing solar spectrum in nature. Since the solar spectrum is constantly changing, the generation of random numbers is highly time-sensitive and difficult to copy or crack, thus improving the randomness, security, and uniqueness of the target random number.
[0049] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0051] Figure 1 This is a flowchart illustrating a random number generation method according to an exemplary embodiment.
[0052] Figure 2This is a logical schematic diagram of a random number generation method according to an exemplary embodiment.
[0053] Figure 3 This is a block diagram illustrating a random number generation apparatus according to an exemplary embodiment.
[0054] Figure 4 This is a block diagram illustrating an electronic device for generating random numbers according to an exemplary embodiment.
[0055] Figure 5 This is a block diagram illustrating an apparatus for generating random numbers according to an exemplary embodiment. Detailed Implementation
[0056] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0057] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure 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 disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0058] Figure 1 This is a flowchart illustrating a random number generation method according to an exemplary embodiment, such as... Figure 1 As shown, the random number generation method includes the following steps.
[0059] In step S11, multiple sets of solar spectral information are acquired, and each set of solar spectral information includes band spectral information of multiple spectral bands.
[0060] In many scenarios, random numbers are required. For example, when two programs interact, random numbers can be appended to the serial number to ensure the uniqueness of the request serial number. Alternatively, random numbers can be used to update the parameter keys in file encryption / decryption or system interaction scenarios to ensure data security. In addition, when persisting data, random numbers can be added to the append to obtain the primary key identifier, which greatly ensures the uniqueness of the primary key.
[0061] In this disclosure, random numbers can be generated based on solar spectral information. Since solar spectral information is constantly changing, the generation of random numbers is more random and uncertain. The solar spectrum can be divided into visible and invisible light. Visible light, after scattering, is divided into seven colors: red, orange, yellow, green, cyan, blue, and violet. Each color of visible light corresponds to a different wavelength band, with red light having a longer wavelength, orange light having a shorter wavelength than red light, and so on, with violet light having the shortest wavelength. Invisible light is divided into two types: infrared light, which has a longer wavelength than red light, and ultraviolet light, which has a shorter wavelength than violet light. The solar spectral information used in this application may include the spectral information of all the above-mentioned bands, or the spectral information of several of them; no specific limitation is made.
[0062] In this step, multiple sets of solar spectral information can be obtained. The solar spectral information includes band spectral information of multiple bands. The band spectral information can refer to the sum or average value of the irradiance values of each wavelength in the corresponding band, or the irradiance value of the median wavelength in the corresponding band, or the maximum, minimum or median value of the irradiance values of each wavelength in the corresponding band. In addition, it can refer to the wavelength with the largest irradiance value in the corresponding band. The specific details are not limited.
[0063] In one implementation, the step of acquiring multiple sets of solar spectral information may include: randomly determining multiple locations and the corresponding time point for each location; and collecting solar spectral information for each location at the corresponding time point. In other words, based on the randomly determined locations and time points, the solar spectral information for that location at that time point is collected. Thus, due to the randomness of the locations and time points, the randomness of the collected solar spectral information is greater, and the randomness of the subsequently obtained random numbers is also greater.
[0064] In step S12, the intermediate value corresponding to each group of solar spectral information is determined based on the included band spectral information.
[0065] After acquiring solar spectral information, for each set of solar spectral information, an intermediate value can be determined based on the spectral information of the included bands. Specifically, the minimum, average, or maximum value of the included bands can be taken, or a preset algorithm can be used to calculate the intermediate value from the included bands.
[0066] In one implementation, each set of solar spectral information includes spectral information from nine bands: the first band, the second band, the third band, the fourth band, the fifth band, the sixth band, the seventh band, the eighth band, and the ninth band. The step of determining the intermediate value corresponding to each set of solar spectral information based on the included spectral bands can include:
[0067] For any set of solar spectral information, the sum of the second and third band spectral information is determined, and the quotient of the first band spectral information and the sum is determined, as the first parameter; the product of the fourth and fifth band spectral information, the reciprocal of the cosine of the sixth band spectral information, and the sine of the seventh band spectral information are determined, as the second parameter; the product of the tangent of the eighth band spectral information and the ninth band spectral information is determined, as the third parameter; and the sum of the first, second, and third parameters is determined as the intermediate value corresponding to any set of solar spectral information.
[0068] For example, the above process can be represented by the following formula:
[0069] R1=k1 / (k2+k3)+(k4*k5) / cos(k6)*sin(k7)+tan(h1)*z1
[0070] Where R1 represents the intermediate value corresponding to a certain set of solar spectral information, k1 represents the first band spectral information in the set of solar spectral information, k2 represents the second band spectral information in the set of solar spectral information, k3 represents the third band spectral information in the set of solar spectral information, k4 represents the fourth band spectral information in the set of solar spectral information, k5 represents the fifth band spectral information in the set of solar spectral information, k6 represents the sixth band spectral information in the set of solar spectral information, k7 represents the seventh band spectral information in the set of solar spectral information, h1 represents the eighth band spectral information in the set of solar spectral information, z1 represents the ninth band spectral information in the set of solar spectral information, and cos, sin, and tan represent cosine operation, sine operation, and tangent operation, respectively.
[0071] The correspondence between the spectral information of the first to ninth bands and the various bands in the solar spectrum can be determined randomly or according to preset rules. For example, the spectral information of the first band can be associated with the red light band, the spectral information of the second band with the orange light band, the spectral information of the third band with the yellow light band, the spectral information of the fourth band with the green light band, the spectral information of the fifth band with the cyan light band, the spectral information of the sixth band with the blue light band, the spectral information of the seventh band with the violet light band, the spectral information of the eighth band with the infrared band, and the spectral information of the ninth band with the ultraviolet light band.
[0072] In step S13, at least one digit is selected from each intermediate value according to the preset digit selection rule, and the selected digits are recombined to obtain the target random number.
[0073] After determining the median value corresponding to each set of solar spectral information, the median value can be digitized. Several digits can be selected from the median value, and then the selected digits can be recombine to obtain the target random number. The preset digit selection rules can include various methods, such as taking the middle two digits of each median value for recombination, or taking the first and last two digits of each median value for recombination, etc., and there are no specific limitations.
[0074] In one implementation, the digit selection rule includes the digit selection position, digit selection length, digit selection direction, and fill character corresponding to each intermediate value. Therefore, the step of selecting at least one digit from each intermediate value according to the preset digit selection rule, and recombining the selected digits to obtain the target random number may include:
[0075] For any intermediate value, determine the digit at the specified position within that intermediate value as the target number. If the length of the remaining digits along the specified direction is not less than the specified position length, select a digit of that specified position length as a candidate value for the intermediate value. If the length of the remaining digits along the specified direction is less than the specified position length, fill the remaining digits with a padding character to obtain a string that meets the specified position length, which is then used as a candidate value for the intermediate value. Randomly recombine multiple candidate values to obtain the target random number. The padding character can be either a number or a letter; there are no specific restrictions.
[0076] In other words, for a given intermediate value, first determine the corresponding position, such as the starting position, the halfway point, or the one-third point, etc.; then, at the position, select a number of digits along the selection direction. For example, if the position is the halfway point, you can select two digits backward from the halfway point, or three digits forward from the halfway point. If the remaining digit length in the selection direction is less than the selection length, use padding characters to fill the gaps, resulting in a string that matches the selection length, which is then used as a candidate value. For example, continuing the above example, if there is only one digit backward from the halfway point, add a padding character to obtain a string containing two characters, which is then used as a candidate value; or, if there is only one digit forward from the halfway point, add two padding characters to obtain a string containing three characters, which is then used as a candidate value. Finally, randomly recombine multiple candidate values to obtain the target random number.
[0077] In this way, the generation of random numbers involves multiple calculations through a hybrid splicing strategy of solar spectral data, which further increases the difficulty of cracking the code and helps to improve the randomness, security and uniqueness of the target random numbers.
[0078] For example, solar spectral information can include four sets, with corresponding intermediate values of the first, second, third, and fourth intermediate values. Then, the position corresponding to the first intermediate value can be set to the halfway point, the position length to 3, the position direction to backward, and the fill character to 0; the position corresponding to the second intermediate value can be set to the one-third point, the position length to 1, the position direction to backward, and the fill character to 2; the position corresponding to the third intermediate value can be set to the one-quarter point, the position length to 2, the position direction to backward, and the fill character to f; and the position corresponding to the fourth intermediate value can be set to the starting position, the position length to 2, the position direction to backward, and the fill character to t.
[0079] In other words, the first intermediate value is truncated to half its length, and three positions are taken from the index. If there are fewer than three positions, 0 is added. The second intermediate value is truncated to half its length, and one position is taken from the index. If there are fewer than three positions, 2 is added. The third intermediate value is truncated to half its length, and two positions are taken from the index. If there are fewer than three positions, f is added. The fourth intermediate value is truncated to two positions from the starting position. If there are fewer than four positions, t is added.
[0080] According to the above settings, if the first median value is 56842567, then take 3 digits from the halfway point to select the candidate value corresponding to the first median value as 256; if the second median value is 94784358, then take 1 digit from the one-third point to select the candidate value corresponding to the second median value as 7; if the third median value is 60487610, then take 2 digits from the one-quarter point to select the candidate value corresponding to the third median value as 48; if the fourth median value is 40849502, then take 2 digits from the starting position to select the candidate value corresponding to the fourth median value as 40. After random recombination, the target random number is 72564048.
[0081] like Figure 2 The diagram shown is a logical schematic of a random number generation method according to an exemplary embodiment. First, considering different regional and temporal differences, the acquisition unit collects four sets of solar spectral information, recording the spectral information of the visible and invisible light bands, including:
[0082] Visible light band spectral information array: {red band spectral information, orange band spectral information, yellow band spectral information, green band spectral information, cyan band spectral information, blue band spectral information, violet band spectral information};
[0083] Invisible light band spectral information values: ultraviolet band spectral information and infrared band spectral information.
[0084] Then, the processing unit calculates the collected solar spectral information to obtain four sets of intermediate value arrays corresponding to the solar spectral information. Next, a bitwise operation is performed on the intermediate value arrays, selecting at least one digit from each intermediate value. The selected digits are then rearranged to obtain the target random number.
[0085] As can be seen from the above, the technical solution provided by the embodiments of this disclosure uses the ever-changing solar spectrum in nature to construct a highly random calculation model. Since the solar spectrum is constantly changing, the generation of random numbers is highly time-sensitive and difficult to copy and crack, thereby improving the randomness, security and uniqueness of the target random number.
[0086] Figure 3 This is a block diagram of a random number generation apparatus according to an exemplary embodiment, the apparatus comprising:
[0087] The acquisition unit 201 is configured to acquire multiple sets of solar spectral information, each set of solar spectral information including band spectral information of multiple bands;
[0088] The determining unit 202 is configured to perform the task of determining the intermediate value corresponding to each group of solar spectral information based on the included band spectral information.
[0089] The recombination unit 203 is configured to perform a process of selecting at least one digit from each intermediate value according to a preset digit selection rule, and recombinating the selected digits to obtain a target random number.
[0090] In one implementation, the acquisition unit 201 is configured to execute:
[0091] Randomly determine multiple locations and the corresponding time points for each location;
[0092] Collect solar spectral information for each location at the corresponding time point.
[0093] In one implementation, each set of solar spectral information includes band spectral information of nine bands, namely, first band spectral information, second band spectral information, third band spectral information, fourth band spectral information, fifth band spectral information, sixth band spectral information, seventh band spectral information, eighth band spectral information, and ninth band spectral information;
[0094] The determining unit 202 is configured to perform the following operations for any set of solar spectral information: determine the sum of the second band spectral information and the third band spectral information; determine the quotient of the first band spectral information and the sum, as a first parameter; determine the product of the fourth band spectral information and the fifth band spectral information, the reciprocal of the cosine of the sixth band spectral information, and the sine of the seventh band spectral information, as a second parameter; determine the product of the tangent of the eighth band spectral information and the ninth band spectral information, as a third parameter; and determine the sum of the first parameter, the second parameter, and the third parameter as the intermediate value corresponding to the any set of solar spectral information.
[0095] In one implementation, the first spectral information corresponds to the red light band, the second spectral information corresponds to the orange light band, the third spectral information corresponds to the yellow light band, the fourth spectral information corresponds to the green light band, the fifth spectral information corresponds to the cyan light band, the sixth spectral information corresponds to the blue light band, the seventh spectral information corresponds to the violet light band, the eighth spectral information corresponds to the infrared light band, and the ninth spectral information corresponds to the ultraviolet light band.
[0096] In one implementation, the position selection rule includes the position selection location, position selection length, position selection direction, and fill character corresponding to each intermediate value;
[0097] The recombination unit 203 is configured to perform the following actions for any intermediate value: determining the number at the position of the intermediate value as the target number; selecting a number of the specified position length as a candidate value if the remaining number length along the position direction is not less than the specified position length; filling the remaining number with the specified padding character to obtain a string that conforms to the specified position length as a candidate value for the intermediate value if the remaining number length along the position direction is less than the specified position length; and randomly recombinating multiple candidate values to obtain a target random number.
[0098] In one implementation, the solar spectral information includes four sets, with corresponding intermediate values being a first intermediate value, a second intermediate value, a third intermediate value, and a fourth intermediate value. The first intermediate value corresponds to a position at the halfway point, a position length of 3, a position direction of backward, and a fill character of 0. The second intermediate value corresponds to a position at the one-third point, a position length of 1, a position direction of backward, and a fill character of 2. The third intermediate value corresponds to a position at the one-quarter point, a position length of 2, a position direction of backward, and a fill character of f. The fourth intermediate value corresponds to a position at the starting point, a position length of 2, a position direction of backward, and a fill character of t.
[0099] As can be seen from the above, the technical solution provided by the embodiments of this disclosure uses the ever-changing solar spectrum in nature to construct a highly random calculation model. Since the solar spectrum is constantly changing, the generation of random numbers is highly time-sensitive and difficult to copy and crack, thereby improving the randomness, security and uniqueness of the target random number.
[0100] Regarding the apparatus in the embodiments described above, the specific manner in which each module performs its operations has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0101] Figure 4 This is a block diagram illustrating an electronic device for generating random numbers according to an exemplary embodiment.
[0102] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions that can be executed by a processor of an electronic device to perform the method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0103] In an exemplary embodiment, a computer program product is also provided that, when run on a computer, enables the computer to implement the method of generating the random number.
[0104] As can be seen from the above, the technical solution provided by the embodiments of this disclosure uses the ever-changing solar spectrum in nature to construct a highly random calculation model. Since the solar spectrum is constantly changing, the generation of random numbers is highly time-sensitive and difficult to copy and crack, thereby improving the randomness, security and uniqueness of the target random number.
[0105] Figure 5 This is a block diagram illustrating an apparatus 800 for generating random numbers according to an exemplary embodiment.
[0106] For example, device 800 can be a mobile phone, computer, digital broadcasting electronic device, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0107] Reference Figure 5 The device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0108] Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps described. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0109] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0110] Power supply component 807 provides power to various components of device 800. Power supply component 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 800.
[0111] Multimedia component 808 includes a screen that provides an output interface between the device 800 and the account. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the account. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0112] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0113] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to, a home button, volume buttons, a power button, and a lock button.
[0114] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of device 800, changes in position of device 800 or a component of device 800, the presence or absence of contact between an account and device 800, orientation or acceleration / deceleration of device 800, and temperature changes of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0115] Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0116] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described in the first and second aspects.
[0117] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of the device 800 to perform the method. Optionally, for example, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.
[0118] In an exemplary embodiment, a computer program product including instructions is also provided, which, when run on a computer, causes the computer to perform any of the random number generation methods described in the embodiments.
[0119] As can be seen from the above, the technical solution provided by the embodiments of this disclosure uses the ever-changing solar spectrum in nature to construct a highly random calculation model. Since the solar spectrum is constantly changing, the generation of random numbers is highly time-sensitive and difficult to copy and crack, thereby improving the randomness, security and uniqueness of the target random number.
[0120] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0121] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for generating random numbers, characterized in that, include: Acquire multiple sets of solar spectral information, each set of solar spectral information including spectral information of multiple bands; Based on the included spectral information of the bands, determine the median value corresponding to each group of solar spectral information; According to the preset digit selection rules, at least one digit is selected from each intermediate value, and the selected digits are recombined to obtain the target random number; Each set of solar spectral information includes spectral information in nine bands: the first band, the second band, the third band, the fourth band, the fifth band, the sixth band, the seventh band, the eighth band, and the ninth band. The step of determining the intermediate value corresponding to each group of solar spectral information based on the included band spectral information includes: For any set of solar spectral information, the sum of the second band spectral information and the third band spectral information is determined, and the quotient of the first band spectral information and the sum is determined as the first parameter; The product of the fourth band spectral information and the fifth band spectral information, the reciprocal of the cosine value of the sixth band spectral information, and the sine value of the seventh band spectral information are determined as the second parameter; The product between the tangent of the eighth band spectral information and the ninth band spectral information is determined as the third parameter; The sum of the first parameter, the second parameter, and the third parameter is determined as the intermediate value corresponding to any set of solar spectral information.
2. The random number generation method according to claim 1, characterized in that, The acquisition of multiple sets of solar spectral information includes: Randomly determine multiple locations and the corresponding time points for each location; Collect solar spectral information for each location at the corresponding time point.
3. The random number generation method according to claim 1, characterized in that, The first spectral band corresponds to the red light band, the second spectral band corresponds to the orange light band, the third spectral band corresponds to the yellow light band, the fourth spectral band corresponds to the green light band, the fifth spectral band corresponds to the cyan light band, the sixth spectral band corresponds to the blue light band, the seventh spectral band corresponds to the violet light band, the eighth spectral band corresponds to the infrared light band, and the ninth spectral band corresponds to the ultraviolet light band.
4. The random number generation method according to claim 1, characterized in that, The position selection rules include the position, length, direction, and fill character corresponding to each intermediate value; The step of selecting at least one digit from each intermediate value according to a preset digit selection rule, and then recombining the selected digits to obtain a target random number includes: For any intermediate value, determine the number at the position of the intermediate value as the target number. If the length of the remaining numbers along the position direction is not less than the position length, select the number of the position length as the candidate value of the intermediate value. If the length of the remaining numbers along the position direction is less than the position length, use the padding character to pad the remaining numbers to obtain a string that meets the position length, which is then used as the candidate value of the intermediate value. The candidate values are randomly recombined to obtain the target random number.
5. The random number generation method according to claim 4, characterized in that, The solar spectral information includes four groups, with corresponding intermediate values being the first intermediate value, the second intermediate value, the third intermediate value, and the fourth intermediate value, respectively. The first intermediate value corresponds to the half position, the position length is 3, the position direction is backward, and the padding character is 0; The second intermediate value corresponds to a position at one-third of the way down, a position length of 1, a position direction of backwards, and a padding character of 2. The third intermediate value corresponds to a quarter position, a position length of 2, a position direction of backward, and a fill character of f; The fourth intermediate value corresponds to the starting position, the position length is 2, the position direction is backward, and the fill character is t.
6. A random number generation device, characterized in that, include: The acquisition unit is configured to acquire multiple sets of solar spectral information, each set of solar spectral information including band spectral information of multiple bands; The determining unit is configured to perform the task of determining the intermediate value corresponding to each group of solar spectral information based on the included band spectral information. The recombination unit is configured to perform the following operations: select at least one digit from each intermediate value according to a preset digit selection rule, recombine the selected digits, and obtain a target random number. Each set of solar spectral information includes spectral information in nine bands: the first band, the second band, the third band, the fourth band, the fifth band, the sixth band, the seventh band, the eighth band, and the ninth band. The determining unit is configured to perform the following operations for any set of solar spectral information: determine the sum of the second band spectral information and the third band spectral information; determine the quotient of the first band spectral information and the sum, as a first parameter; determine the product of the fourth band spectral information and the fifth band spectral information, the reciprocal of the cosine of the sixth band spectral information, and the sine of the seventh band spectral information, as a second parameter; determine the product of the tangent of the eighth band spectral information and the ninth band spectral information, as a third parameter; and determine the sum of the first parameter, the second parameter, and the third parameter as the intermediate value corresponding to the any set of solar spectral information.
7. The random number generation device according to claim 6, characterized in that, The acquisition unit is configured to execute: Randomly determine multiple locations and the corresponding time points for each location; Collect solar spectral information for each location at the corresponding time point.
8. The random number generation device according to claim 6, characterized in that, The first spectral band corresponds to the red light band, the second spectral band corresponds to the orange light band, the third spectral band corresponds to the yellow light band, the fourth spectral band corresponds to the green light band, the fifth spectral band corresponds to the cyan light band, the sixth spectral band corresponds to the blue light band, the seventh spectral band corresponds to the violet light band, the eighth spectral band corresponds to the infrared light band, and the ninth spectral band corresponds to the ultraviolet light band.
9. The random number generation device according to claim 6, characterized in that, The position selection rules include the position, length, direction, and fill character corresponding to each intermediate value; The recombination unit is configured to, for any intermediate value, determine the number at the position of the intermediate value as the target number; if the length of the remaining numbers along the position direction is not less than the position length, select a number of the position length as a candidate value of the intermediate value; if the length of the remaining numbers along the position direction is less than the position length, fill the remaining numbers with the padding character to obtain a string that conforms to the position length as a candidate value of the intermediate value; and randomly recombine multiple candidate values to obtain a target random number.
10. The random number generation device according to claim 9, characterized in that, The solar spectral information includes four sets, with corresponding intermediate values of a first intermediate value, a second intermediate value, a third intermediate value, and a fourth intermediate value. The first intermediate value corresponds to a position at the halfway point, a position length of 3, a position direction of backward, and a fill character of 0. The second intermediate value corresponds to a position at the one-third point, a position length of 1, a position direction of backward, and a fill character of 2. The third intermediate value corresponds to a position at the one-quarter point, a position length of 2, a position direction of backward, and a fill character of f. The fourth intermediate value corresponds to a position at the beginning, a position length of 2, a position direction of backward, and a fill character of t.
11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the random number generation method as described in any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the random number generating electronic device, the random number generating electronic device is able to perform the random number generation method as described in any one of claims 1 to 5.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the random number generation method according to any one of claims 1-5.
Citation Information
Patent Citations
Method and device for acquiring spectral information, terminal equipment and storage medium
CN114429452A
Random bit string generator
WO2020179498A1