WO2022142111A1 - 随机数生成方法、装置、电子设备及存储介质 - Google Patents
随机数生成方法、装置、电子设备及存储介质 Download PDFInfo
- Publication number
- WO2022142111A1 WO2022142111A1 PCT/CN2021/096637 CN2021096637W WO2022142111A1 WO 2022142111 A1 WO2022142111 A1 WO 2022142111A1 CN 2021096637 W CN2021096637 W CN 2021096637W WO 2022142111 A1 WO2022142111 A1 WO 2022142111A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- random number
- node
- random
- parameter information
- root node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/58—Random or pseudo-random number generators
- G06F7/588—Random number generators, i.e. based on natural stochastic processes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/01—Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0201—Market modelling; Market analysis; Collecting market data
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
Definitions
- the present application relates to the technical field of artificial intelligence, and in particular to a random number generation method, device, electronic device and storage medium.
- the appropriateness of random number generation is related to the security and reliability of the system.
- the randomness of the random number itself needs to be generated from a reliable physical random source. Sampling multiple index sets for weighting, but the inventor realizes that direct use or simple weighting cannot fully guarantee that the index is operated as a random number seed, and it is unavoidable that the random number seed is changed, resulting in an inconsistency in the security and reliability of the generated random number. high.
- a first aspect of the present application provides a random number generation method, the method comprising:
- a delay function is called, and a first random number is generated in the root node of the decision tree according to the random number seed and the random parameter information;
- the first random number is input to the next node of the root node, according to the first random number and the root node
- the random parameter information of the next node of the node generates a second random number, and the above process is repeated until the next node is a leaf node;
- the target random number is generated according to the random parameter information of the leaf node and the random number received by the leaf node.
- a second aspect of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory for storing at least one computer-readable instruction, the processor for executing the at least one computer-readable instruction to Implement the following steps:
- a delay function is called, and a first random number is generated in the root node of the decision tree according to the random number seed and the random parameter information;
- the first random number is input to the next node of the root node, according to the first random number and the root node
- the random parameter information of the next node of the node generates a second random number, and the above process is repeated until the next node is a leaf node;
- the target random number is generated according to the random parameter information of the leaf node and the random number received by the leaf node.
- a third aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, implements the following steps:
- a delay function is called, and a first random number is generated in the root node of the decision tree according to the random number seed and the random parameter information;
- the first random number is input to the next node of the root node, according to the first random number and the root node
- the random parameter information of the next node of the node generates a second random number, and the above process is repeated until the next node is a leaf node;
- the target random number is generated according to the random parameter information of the leaf node and the random number received by the leaf node.
- a fourth aspect of the present application provides an apparatus for generating random numbers, the apparatus comprising:
- the receiving module is used to receive the random number generation request sent by the client;
- a parsing module configured to parse the random generation request to obtain market index information, and generate a decision tree including execution conditions according to the market index information, wherein each node of the decision tree contains random number seeds and random parameter information ;
- a calling module configured to call a delay function when monitoring that the market index information meets an execution condition, and generate a first random number in the root node of the decision tree according to the random number seed and the random parameter information;
- a verification module configured to verify whether the first random number is transmitted to the next node of the root node through the verification algorithm of the delay function
- an input module configured to input the first random number to the next node of the root node when it is determined to transmit the first random number to the next node of the root node, according to the first random number generating a second random number with the random parameter information of the next node of the root node and repeating the above process until the next node is a leaf node;
- a generating module configured to generate a target random number according to the random parameter information of the leaf node and the random number received by the leaf node.
- the random number generation method, device, electronic device and storage medium described in this application obtains a plurality of market index information by parsing each of the random generation requests, and according to the market index information Generate a decision tree including execution conditions.
- the execution sequence of each node in the decision tree can be quickly determined, which can improve the generation of random numbers.
- a delay function calculation is set, and the random number obtained by the calculation of the previous node is used as The input of the delay sub-function of the next node is calculated in a serial manner to obtain the target random number, which avoids the phenomenon of modifying the market index information at any time when the publisher finds that the random number generated by the market index information is unfavorable, and improves the target random number. safety.
- FIG. 1 is a flowchart of a random number generation method provided in Embodiment 1 of the present application.
- FIG. 2 is a structural diagram of a random number generating apparatus provided in Embodiment 2 of the present application.
- FIG. 3 is a schematic structural diagram of an electronic device provided in Embodiment 3 of the present application.
- FIG. 1 is a flowchart of a random number generation method provided in Embodiment 1 of the present application.
- the random number generation method can be applied to an electronic device.
- the random number generation function provided by the method of the present application can be directly integrated on the electronic device, or It runs in electronic devices in the form of a software development kit (SKD).
- the random number generation method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart may be changed, and some may be omitted.
- the client when acquiring random numbers, the client initiates a random number generation request through the client.
- the client may be a smartphone, an IPAD, or other devices, and the server may be a random number generation system.
- the client may send a random number generation request to a random number generation system, and the random number generation system is configured to receive the random number generation request sent by the client.
- S12 Parse the random generation request to obtain market index information, and generate a decision tree including execution conditions according to the market index information, wherein each node of the decision tree contains random number seeds and random parameter information.
- the server receives multiple market index information sent by different clients, and generates different decision trees for different market index information, wherein each decision tree includes execution conditions.
- the release time of each market index information is different, so the execution condition for determining the decision tree may be the arrival time.
- the execution condition of the decision tree may also be reaching a specified state.
- the market index information includes, but is not limited to, random number seeds and multiple random parameter information.
- generating a decision tree including execution conditions according to the market index information includes:
- the child node When judging that there is a child node with the same time difference as the time difference, the child node is used as a parent node, and the remaining random parameter information is used as a child node of the parent node;
- the root node When it is determined that there is no child node with the same time difference as the time difference, the root node is used as a parent node, and the remaining random parameter information is used as a child node of the parent node, wherein the random parameter at the parent node is The time difference between the information and the corresponding random parameter information at the child node is used as the weight of the edge between the parent node and the child node.
- the market index information includes a plurality of random parameter information, one random parameter information is randomly selected as the root node of the decision tree corresponding to the market index information, and then the relationship between any other random parameter information and all the other random parameter information is calculated.
- the time difference between the random parameter information at the root node, the execution order of each node in the decision tree can be determined according to the time difference, and when it is judged that there is a child node that is the same as the time difference, the child node is used as the time difference.
- the parent node, and the remaining random parameter information is used as the child node of the parent node; when it is judged that there is no child node with the same time difference as the time difference, the root node is used as the parent node, and the remaining random parameters are used. information as child nodes of the parent node.
- each node in the decision tree is quickly determined.
- the order of execution can improve the efficiency of random number generation and the management efficiency of market index information.
- a corresponding decision tree is created according to the market index information, and the execution conditions of each decision tree are different, and the corresponding decision tree is executed only when the execution conditions are satisfied, which improves the management efficiency of the decision tree.
- the monitoring whether the market index information satisfies the execution condition includes:
- the market index information includes a start time of recording the market index, and after the start time passes a specified time parameter, triggering the execution of the decision tree.
- the specified time parameter can be the time parameter input by the client, such as 60 minutes; then when 60 minutes after the starting time is reached, the execution of the decision tree is triggered; the specified time parameter can also be the system For the calculated time parameter, if the client specifies that the decision tree is executed at 20:00, and the starting time is 18:00, the system calculates and obtains that the specified time parameter is 120 minutes.
- the specified time parameter may also be the first time parameter obtained by dynamic calculation, which also belongs to the protection scope of the present disclosure.
- a delay function is called, and a first random number is generated in the root node of the decision tree according to the random number seed and the random parameter information .
- the generating the first random number in the root node of the decision tree according to the random number seed and the random parameter information includes:
- the first random number is obtained by calling the first delay sub-function to calculate the random number seed and the random parameter information.
- the delay function includes a plurality of delay sub-functions, and the delay sub-functions in each child node are different. Therefore, when determining to execute the decision tree, first start from the root of the decision tree. The first delay sub-function of the delay function is extracted from the random parameter information of the node, and the random number seed is calculated to obtain a first random number.
- the verification algorithm of the delay function needs to be used to verify the Whether the first random number can be transmitted to the next node of the root node.
- the verifying whether to transmit the first random number to the next node of the root node through the verification algorithm of the delay function includes:
- the method also includes:
- the first random number is discarded.
- a first hash value is obtained by calculating the first random number through a hash operation
- a second hash value is obtained by calculating a target random parameter in the next node of the root node
- the first hash value is determined. Whether a hash value is consistent with the second hash value, it is determined according to the judgment result whether the first random number can be transmitted to the next node of the root node, only the first hash value and the When the second hash values are consistent, it is determined that the first random number can be used as the input of the next node of the root node.
- the decision tree since the decision tree includes multiple nodes, and the input and output of each node are dependent, the first random number is input to the next node of the root node, according to the first random number.
- the random number and the random parameter information of the next node of the root node generate a second random number, and the above process is repeated until the next node is a leaf node.
- the generating the second random number according to the first random number and random parameter information of the next node of the root node includes:
- the second random number is obtained by calling the second delay sub-function to calculate the first random number and random parameter information of the next node of the root node.
- each random parameter information contains a delay sub-function
- the second delay sub-function of the delay function is extracted from the random parameter information of the next node of the root node, and the second delay sub-function of the delay function is called.
- the second delay sub-function calculates the first random number and random parameter information of the next node of the root node to obtain a second random number.
- S16 Generate a target random number according to the random parameter information of the leaf node and the random number received by the leaf node.
- the leaf node is the end node of the decision tree.
- the received random number generates a target random number.
- the generation of the target random number according to the random parameter information of the leaf node and the random number received by the leaf node includes:
- the target random number is obtained by calling the target delay sub-function to calculate the random number received by the leaf node and the random parameter information of the leaf node.
- the target random number is generated by the previous node of the leaf node according to the random number transmitted by the previous node of the previous node of the leaf node and the random parameter information of the previous node of the leaf node, The phenomenon that the random number seed is modified is avoided, and the security of the generated target random number is improved.
- a decision tree including execution conditions is generated from the market index information, and when the execution conditions are satisfied, all child nodes in the decision tree are traversed sequentially from the root node of the decision tree, and the delay is called.
- a delay function calculation is set in the process of generating the target random number, the random number obtained by the calculation of the previous node is used as the input of the delay sub-function of the next node, and the target random number is obtained by serial calculation.
- the method further includes:
- the target random number is fed back to the terminal device corresponding to the calculation result receiving address;
- the target random number is discarded.
- the method includes:
- the ciphertext is fed back to the terminal device corresponding to the receiving address of the calculation result corresponding to the target random number.
- the method for random number generation described in this embodiment obtains a plurality of market index information by parsing each of the random generation requests, and generates a decision tree including execution conditions according to the market index information, In the process of creating a decision tree, by calculating the time difference between each random parameter information, the execution sequence of each node in the decision tree can be quickly determined, which can improve the efficiency of random number generation and the management of market index information.
- All child nodes in the decision tree and call the delay function, set a delay function calculation in the process of generating the target random number, and use the random number obtained by the calculation of the previous node as the delay sub-function of the next node
- the target random number is obtained by serial calculation, which avoids the phenomenon of modifying the market index information at any time when the publisher finds that the random number generated by the market index information is unfavorable, and improves the security of the target random number.
- FIG. 2 is a structural diagram of a random number generating apparatus provided in Embodiment 2 of the present application.
- the random number generating apparatus 20 may include a plurality of functional modules composed of program code segments.
- the program codes of each program segment in the random number generating apparatus 20 may be stored in the memory of the electronic device and executed by the at least one processor to perform the random number generating function (see description in FIG. 1 for details).
- the random number generating apparatus 20 may be divided into multiple functional modules according to the functions performed by the random number generating apparatus 20 .
- the functional modules may include: a receiving module 201 , a parsing module 202 , a calling module 203 , a checking module 204 , an inputting module 205 , a generating module 206 and a checking module 207 .
- a module referred to in this application refers to a series of computer-readable instruction segments that can be executed by at least one processor and can perform fixed functions, and are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
- the receiving module 201 is configured to receive a random number generation request sent by the client.
- the client when acquiring random numbers, the client initiates a random number generation request through the client.
- the client may be a smartphone, an IPAD, or other devices, and the server may be a random number generation system.
- the client may send a random number generation request to a random number generation system, and the random number generation system is configured to receive the random number generation request sent by the client.
- a parsing module 202 configured to parse the random generation request to obtain market index information, and generate a decision tree including execution conditions according to the market index information, wherein each node of the decision tree contains random number seeds and random parameters information.
- the server receives multiple market index information sent by different clients, and generates different decision trees for different market index information, wherein each decision tree includes execution conditions.
- the release time of each market index information is different, so the execution condition for determining the decision tree may be the arrival time.
- the execution condition of the decision tree may also be reaching a specified state.
- the market index information includes, but is not limited to, random number seeds and multiple random parameter information.
- the analysis module 202 generates a decision tree including execution conditions according to the market index information, including:
- the child node When it is judged that there is a child node with the same time difference as the time difference, the child node is used as a parent node, and the remaining random parameter information is used as a child node of the parent node;
- the root node When it is judged that there is no child node with the same time difference as the time difference, the root node is used as the parent node, and the rest of the random parameter information is used as the child nodes of the parent node, wherein the random parameter at the parent node
- the time difference between the information and the corresponding random parameter information at the child node is used as the weight of the edge between the parent node and the child node.
- the market index information includes a plurality of random parameter information, one random parameter information is randomly selected as the root node of the decision tree corresponding to the market index information, and then the relationship between any other random parameter information and all the other random parameter information is calculated.
- the time difference between the random parameter information at the root node, the execution order of each node in the decision tree can be determined according to the time difference, and when it is judged that there is a child node that is the same as the time difference, the child node is used as The parent node, and the remaining random parameter information is used as the child node of the parent node; when it is judged that there is no child node with the same time difference as the time difference, the root node is used as the parent node, and the remaining random parameters are used. information as child nodes of the parent node.
- each node in the decision tree is quickly determined.
- the order of execution can improve the efficiency of random number generation and the management efficiency of market index information.
- the calling module 203 is configured to call a delay function when monitoring that the market index information meets the execution conditions, and generate a first random number in the root node of the decision tree according to the random number seed and the random parameter information .
- a corresponding decision tree is created according to the market index information, and the execution conditions of each decision tree are different, and the corresponding decision tree is executed only when the execution conditions are satisfied, which improves the management efficiency of the decision tree.
- the invoking module 203 monitoring whether the market index information satisfies the execution condition includes:
- the market index information includes a start time of recording the market index, and after the start time passes a specified time parameter, triggering the execution of the decision tree.
- the specified time parameter can be the time parameter input by the client, such as 60 minutes; then when 60 minutes after the starting time is reached, the execution of the decision tree is triggered; the specified time parameter can also be the system For the calculated time parameter, if the client specifies that the decision tree is executed at 20:00, and the starting time is 18:00, the system calculates and obtains that the specified time parameter is 120 minutes.
- the specified time parameter may also be the first time parameter obtained by dynamic calculation, which also belongs to the protection scope of the present disclosure.
- a delay function is called, and a first random number is generated in the root node of the decision tree according to the random number seed and the random parameter information .
- the invoking module 203 generating the first random number in the root node of the decision tree according to the random number seed and the random parameter information includes:
- the first random number is obtained by calling the first delay sub-function to calculate the random number seed and the random parameter information.
- the delay function includes a plurality of delay sub-functions, and the delay sub-functions in each child node are different. Therefore, when determining to execute the decision tree, first start from the root of the decision tree. The first delay sub-function of the delay function is extracted from the random parameter information of the node, and the random number seed is calculated to obtain a first random number.
- the verification module 204 is configured to verify whether the first random number is transmitted to the next node of the root node through the verification algorithm of the delay function.
- the verification algorithm of the delay function needs to be used to verify the Whether the first random number can be transmitted to the next node of the root node.
- the checking module 204 checking whether to transmit the first random number to the next node of the root node through a checking algorithm of the delay function includes:
- the first random number is discarded.
- a first hash value is obtained by calculating the first random number through a hash operation
- a second hash value is obtained by calculating a target random parameter in the next node of the root node
- the first hash value is determined. Whether a hash value is consistent with the second hash value, it is determined according to the judgment result whether the first random number can be transmitted to the next node of the root node, only the first hash value and the When the second hash values are consistent, it is determined that the first random number can be used as the input of the next node of the root node.
- the input module 205 is configured to input the first random number to the next node of the root node when it is determined to transmit the first random number to the next node of the root node, according to the first random number
- the random number and the random parameter information of the next node of the root node generate a second random number, and the above process is repeated until the next node is a leaf node.
- the decision tree contains multiple nodes, and the input and output of each node are dependent, the first random number is input to the next node of the root node, according to the first random number The random number and the random parameter information of the next node of the root node generate a second random number, and the above process is repeated until the next node is a leaf node.
- the generating of the second random number by the input module 205 according to the first random number and random parameter information of the next node of the root node includes:
- the second random number is obtained by calling the second delay sub-function to calculate the first random number and random parameter information of the next node of the root node.
- each random parameter information includes a delay sub-function
- the second delay sub-function of the delay function is extracted from the random parameter information of the next node of the root node, and the second delay sub-function of the delay function is called.
- the second delay sub-function calculates the first random number and random parameter information of the next node of the root node to obtain a second random number.
- the generating module 206 is configured to generate a target random number according to the random parameter information of the leaf node and the random number received by the leaf node.
- the leaf node is the end node of the decision tree.
- the received random number generates a target random number.
- the generation module 206 generates a target random number according to the random parameter information of the leaf node and the random number received by the leaf node, including:
- the target random number is obtained by calling the target delay sub-function to calculate the random number received by the leaf node and random parameter information of the leaf node.
- the target random number is generated by the previous node of the leaf node according to the random number transmitted by the previous node of the previous node of the leaf node and the random parameter information of the previous node of the leaf node, The phenomenon that the random number seed is modified is avoided, and the security of the generated target random number is improved.
- a decision tree including execution conditions is generated from the market index information, and when the execution conditions are satisfied, all child nodes in the decision tree are traversed sequentially from the root node of the decision tree, and the delay is called.
- a delay function calculation is set in the process of generating the target random number, the random number obtained by the calculation of the previous node is used as the input of the delay sub-function of the next node, and the target random number is obtained by serial calculation.
- the detection module 207 is used to detect whether the address of the leaf node corresponding to the target random number is the The calculation result receiving address in the market index information; when the address of the leaf node corresponding to the target random number is the calculation result receiving address in the market index information, the target random number is fed back to the corresponding calculation result receiving address When the address of the leaf node corresponding to the target random number is not the receiving address of the calculation result in the market index information, the target random number is discarded.
- the target random number is fed back to the terminal device corresponding to the receiving address of the calculation result
- the target random number is encrypted using multiple random number encryption methods to obtain a ciphertext; the ciphertext is fed back The terminal device corresponding to the receiving address of the calculation result corresponding to the target random number.
- the device for generating random numbers obtains a plurality of market index information by parsing each of the random generation requests, and generates a decision tree including execution conditions according to the market index information, In the process of creating a decision tree, by calculating the time difference between each random parameter information, the execution sequence of each node in the decision tree can be quickly determined, which can improve the efficiency of random number generation and the management of market index information.
- All child nodes in the decision tree and call the delay function, set a delay function calculation in the process of generating the target random number, and use the random number obtained by the calculation of the previous node as the delay sub-function of the next node
- the target random number is obtained by serial calculation, which avoids the phenomenon of modifying the market index information at any time when the publisher finds that the random number generated by the market index information is unfavorable, and improves the security of the target random number.
- the electronic device 3 includes a memory 31 , at least one processor 32 , at least one communication bus 33 and a transceiver 34 .
- the structure of the electronic device shown in FIG. 3 does not constitute a limitation of the embodiments of the present application, and may be a bus-type structure or a star-shaped structure, and the electronic device 3 may also include a schematic more or less other hardware or software, or a different arrangement of components is shown.
- the electronic device 3 is an electronic device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits , programmable gate arrays, digital processors and embedded devices.
- the electronic device 3 may also include a client device, which includes but is not limited to any electronic product that can perform human-computer interaction with a client through a keyboard, a mouse, a remote control, a touchpad, or a voice-activated device, for example, Personal computers, tablets, smartphones, digital cameras, etc.
- the electronic device 3 is only an example, and other existing or future electronic products, if applicable to the present application, should also be included within the protection scope of the present application, and incorporated herein by reference .
- the memory 31 is used to store program codes and various data, such as the random number generating device 20 installed in the electronic device 3 , and realizes high-speed and automatic operation during the operation of the electronic device 3 .
- Complete program or data access comprises read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM) , One-time Programmable Read-Only Memory (OTPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read- Only Memory, CD-ROM) or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
- Read-Only Memory Read-Only Memory
- PROM programmable read-only memory
- PROM erasable programmable read-only memory
- OTPROM One-time Programmable Read-Only Memory
- EEPROM
- the at least one processor 32 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including a Or a combination of multiple central processing units (Central Processing units, CPUs), microprocessors, digital processing chips, graphics processors, and various control chips.
- the at least one processor 32 is the control core (Control Unit) of the electronic device 3, and uses various interfaces and lines to connect various components of the entire electronic device 3, by running or executing the program stored in the memory 31 or modules, and call data stored in the memory 31 to perform various functions of the electronic device 3 and process data.
- Control Unit Control Unit
- the at least one communication bus 33 is configured to enable connection communication between the memory 31 and the at least one processor 32 and the like.
- the electronic device 3 may also include a power source (such as a battery) for supplying power to various components.
- the power source may be logically connected to the at least one processor 32 through a power management device, so that the power management device Implement functions such as managing charging, discharging, and power consumption.
- the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
- the electronic device 3 may further include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
- the above-mentioned integrated units implemented in the form of software functional modules may be stored in a computer-readable storage medium.
- the above-mentioned software function modules are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, an electronic device, or a network device, etc.) or a processor (processor) to execute the methods described in the various embodiments of the present application. part.
- the at least one processor 32 can execute the operating device of the electronic device 3 and various installed application programs (such as the random number generating device 20 ), program codes, etc. , for example, the various modules above.
- Program codes are stored in the memory 31, and the at least one processor 32 can call the program codes stored in the memory 31 to perform related functions.
- each module described in FIG. 2 is a program code stored in the memory 31 and executed by the at least one processor 32, so as to realize the function of each module and achieve the purpose of generating random numbers.
- the program code may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 31 and executed by the processor 32 to complete the present invention.
- the one or more modules/units may be a series of computer-readable instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the program code in the electronic device 3 .
- the program code can be divided into a receiving module 201 , a parsing module 202 , a calling module 203 , a checking module 204 , an inputting module 205 , a generating module 206 and a checking module 207 .
- the memory 31 stores a plurality of computer-readable instructions, and the plurality of computer-readable instructions are executed by the at least one processor 32 to realize the function of generating random numbers.
- the computer-readable storage medium may be non-volatile or volatile.
- modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本申请涉及人工智能技术领域,提供一种随机数生成方法、装置、电子设备及存储介质,所述方法包括: 解析随机生成请求得到行情指数信息,生成包括执行条件的决策树; 当监测到行情指数信息满足执行条件时,调用延时函数,在决策树的根节点中根据随机数种子和随机参数信息生成第一随机数; 当确定将第一随机数传输至根节点的下一个节点时,重复上述过程,直至下一个节点为叶子节点; 根据叶子节点的随机参数信息和叶子节点接收到的随机数生成目标随机数。本申请通过将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,避免了随机数种子被修改的现象,提高了目标随机数的安全性。
Description
本申请要求于2020年12月29日提交中国专利局,申请号为202011594073.X申请名称为“随机数生成方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及人工智能技术领域,具体涉及一种随机数生成方法、装置、电子设备及存储介质。
在计算机安全领域,随机数的生成是否恰当,关系到系统的安全可靠程度,在公平投票领域,随机数本身的随机性需要从可靠的物理随机源产生,现有技术通过从可靠的物理随机源采样多个指数集合加权,但是发明人意识到直接采用或者简单的加权不能完全保证指数作为随机数种子被操作,无法避免随机数种子被更改,导致生成的随机数的安全性及可信度不高。
发明内容
鉴于以上内容,有必要提出一种随机数生成方法、装置、电子设备及存储介质,通过将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,避免了随机数种子被修改的现象,提高了目标随机数的安全性。
本申请的第一方面提供一种随机数生成方法,所述方法包括:
接收客户端发送的随机数生成请求;
解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;
当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;
通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;
当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;
根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
本申请的第二方面提供一种电子设备,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:
接收客户端发送的随机数生成请求;
解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;
当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;
通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;
当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输 入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;
根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
本申请的第三方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
接收客户端发送的随机数生成请求;
解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;
当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;
通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;
当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;
根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
本申请的第四方面提供一种随机数生成装置,所述装置包括:
接收模块,用于接收客户端发送的随机数生成请求;
解析模块,用于解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;
调用模块,用于当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;
检验模块,用于通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;
输入模块,用于当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;
生成模块,用于根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
综上所述,本申请所述的一种随机数生成方法、装置、电子设备及存储介质,一方面,通过解析每个所述随机生成请求获取多个行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,在创建决策树的过程中,通过计算每个随机参数信息之间的时间差,快速的确定出所述决策树中每个节点的执行先后顺序,可以提高随机数生成的效率及行情指数信息的管理效率;另一方面,通过验证所述上一个节点的输出是否为下一个节点的输入,保证计算时串行的,形成计算的先后依赖关系,使得并行的加速设备无法缩短实际的运行时间,从而达到延时的目的,提高了计算过程中的安全性;最后,通过将所述行情指数信息生成包括执行条件的决策树,当满足执行条件时从所述决策树的根节点开始依次遍历所述决策树中的所有子节点,并调用延时函数,在生成目标随机数的流程中设定了一个延时函数计算,将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,避免了当发布者发现行情指数信息生成的随机数不利时随时修改行情指数信息的现象,提高了目标随机数的安全性。
图1是本申请实施例一提供的随机数生成方法的流程图。
图2是本申请实施例二提供的随机数生成装置的结构图。
图3是本申请实施例三提供的电子设备的结构示意图。
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
实施例一
图1是本申请实施例一提供的随机数生成方法的流程图。
在本实施例中,所述随机数生成方法可以应用于电子设备中,对于需要进行随机数生成的电子设备,可以直接在电子设备上集成本申请的方法所提供的随机数生成的功能,或者以软件开发工具包(Software Development Kit,SKD)的形式运行在电子设备中。
如图1所示,所述随机数生成方法具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些可以省略。
S11,接收客户端发送的随机数生成请求。
本实施例中,客户端在进行随机数获取时,通过客户端发起随机数生成请求,具体地,所述客户端可以是智能手机、IPAD或者其他设备,所述服务器可以为随机数生成系统,在进行随机数生成过程中,如所述客户端可以向随机数生成系统发送随机数生成请求,所述随机数生成系统用于接收所述客户端发送的随机数生成请求。
S12,解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息。
本实施例中,在所述服务器接收到不同的客户端发送的多个行情指数信息,针对不同的行情指数信息生成不同的决策树,其中,每个决策树包含有执行条件,具体地,由于每个行情指数信息的发布时间不同,故在确定所述决策树的执行条件可以是到达指点时间。
在其他一些实施例中,所述决策树的执行条件也可以是到达指定状态。
在其他一些实施例中,所述行情指数信息中包括,但不限于随机数种子、多个随机参数信息。
可选地,所述根据所述行情指数信息生成包括执行条件的决策树包括:
随机选取所述行情指数信息中的一个随机参数信息作为所述行情指数信息的决策树的根节点;
计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差;
判断是否存在与所述时间差相同的子节点;
当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;
当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点,其中,所述父节点处的随机参数信息与对应的所述子节点处的随机参数信息之间的时间差作为所述父节点和所述子节点之间的边的权重。
本实施例中,所述行情指数信息中包含有多个随机参数信息,随机选取一个随机参数信息作为所述行情指数信息的对应的决策树的根节点,然后计算其余任意一个随机参 数信息与所述根节点处的随机参数信息之间的时间差,根据所述时间差可以确定所述决策树中每个节点的执行顺序,当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点。
本实施例中,在根据所述行情指数信息中的多个随机参数信息创建决策树的过程中,通过计算每个随机参数信息之间的时间差,快速的确定出所述决策树中每个节点的执行先后顺序,可以提高随机数生成的效率及行情指数信息的管理效率。
S13,当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数。
本实施例中,根据行情指数信息创建对应的决策树,并且每个决策树的执行条件不同,只有在满足执行条件的才进行对应的决策树的执行,提高了决策树的管理效率。
可选地,所述监测所述行情指数信息是否满足所述执行条件包括:
监测所述行情指数信息对应的时间参数,其中,所述时间参数是根据所述行情指数的发布时间预先设置的;
判断所述时间参数是否达到预设的执行时间阈值;
当所述时间参数达到所述预设的执行时间阈值时,确定监测到所述行情指数信息满足所述执行条件;
当所述时间参数未达到所述预设的执行时间阈值时,确定监测到所述行情指数信息不满足所述执行条件。
示例性的,所述行情指数信息中包括记录所述行情指数的起始时刻,在起始时刻之后经过指定的时间参数,触发所述决策树执行。其中,所述指定的时间参数可以是客户端输入的时间参数,如60分钟;则在达到起始时刻后的60分钟时,触发所述决策树执行;所述指定的时间参数也可以是系统计算得到的时间参数,如客户端指定20:00执行决策树,所述起始时刻为18:00,则系统计算得到所述指定的时间参数为120分钟。当然,在其他一些实施例中,所述指定的时间参数也可以是通过动态计算得到的第一时间参数,这同样属于本公开的保护范围。
本实施例中,通过为每个决策树设置执行条件,避免在服务器接收的随机数生成请求较多时出现执行混乱的现象,提高了行情指数信息的管理效率,进而提高了随机数生成的效率及准确率。
本实施例中,在随机数生成系统中进行随机数生成的过程中,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数。
在其他可选的实施例中,所述在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数包括:
从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数;
调用所述第一延时子函数对所述随机数种子和所述随机参数信息进行计算得到第一随机数。
本实施例中,所述延时函数中包含有多个延时子函数,并且每个子节点中的延时子函数不同,故在确定执行所述决策树时,首先从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数对所述随机数种子进行计算得到第一随机数。
S14,通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点。
本实施例中,由于延时函数的每一个延时子函数的计算输出依赖于下一个延时子函数的输入,故在得到第一随机数之后,需要采用延时函数的验证算法检验所述第一随机数是否可以传输至所述根节点的下一个节点。
可选地,所述通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点包括:
对所述第一随机数进行哈希运算,得到第一哈希值;
对所述根节点的下一个节点的随机参数信息中的目标随机参数进行哈希运算,得到第二哈希值;
判断所述第一哈希值与所述第二哈希值是否一致;
当所述第一哈希值与所述第二哈希值一致时,确定将所述第一随机数传输至所述根节点的下一个节点;或者
当所述第一哈希值与所述第二哈希值不一致时,确定不将所述第一随机数传输至所述根节点的下一个节点。
进一步地,所述方法还包括:
当确定不将所述第一随机数传输至所述根节点的下一个节点之后,丢弃所述第一随机数。
本实施例中,通过哈希运算对所述第一随机数进行计算得到第一哈希值,对根节点的下一个节点中的目标随机参数进行计算得到第二哈希值,判断所述第一哈希值与所述第二哈希值是否一致,根据判断结果确定是否可以将所述第一随机数传输至所述根节点的下一个节点,只有所述第一哈希值与所述第二哈希值一致时,确定所述第一随机数可以作为所述根节点的下一个节点的输入。
本实施例中,通过验证所述上一个节点的输出是否为下一个节点的输入,保证计算时串行的,形成计算的先后依赖关系,使得并行的加速设备无法缩短实际的运行时间,从而达到延时的目的,提高了计算过程中的安全性。
S15,当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点。
本实施例中,由于决策树中包含有多个节点,每个节点的输入和输出存在依赖关系,故将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点。
可选地,所述根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数包括:
从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数;
调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
本实施例中,每个随机参数信息中包含有延时子函数,从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数,并调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
S16,根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
本实施例中,所述叶子节点为所述决策树的结束节点,当接收到所述叶子节点的上一个节点传输的目标随机数时,根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数,具体地,所述根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数包括:
从所述叶子节点的随机参数信息中提取所述延时函数的目标延时子函数;
调用所述目标延时子函数对所述叶子节点接收到的随机数和所述叶子节点的随机 参数信息进行计算得到目标随机数。
其中,所述目标随机数是指所述叶子节点的上一个节点根据所述叶子节点的上一个节点的上一个节点传输的随机数和所述叶子节点的上一个节点的随机参数信息生成的,避免了随机数种子被修改的现象,提高了生成的目标随机数的安全性。
本实施例中,通过将所述行情指数信息生成包括执行条件的决策树,当满足执行条件时从所述决策树的根节点开始依次遍历所述决策树中的所有子节点,并调用延时函数,在生成目标随机数的流程中设定了一个延时函数计算,将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,可以保证在经过所述延时函数计算之后,发布者无法立即知道随机数是什么,故无法评判随机数的利弊,只能将随机数种子放入延时函数中进行计算,等待计算结果,当所述计算结果出来时,已经经过了一个延时函数,就算对所述发布者不利,也无法进行更改,避免了当发布者发现行情指数信息生成的随机数不利时随时修改行情指数信息的现象,提高了目标随机数的安全性。
进一步地,在根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数之后,所述方法还包括:
检测所述目标随机数对应的叶子节点的地址是否为所述行情指数信息中的计算结果接收地址;
当所述目标随机数对应的叶子节点的地址为所述行情指数信息中的计算结果接收地址,将所述目标随机数反馈至所述计算结果接收地址对应的终端设备;或者
若所述目标随机数对应的叶子节点的地址不为所述行情指数信息中的计算结果接收地址,丢弃所述目标随机数。
在其他一些实施例中,在将所述目标随机数反馈至计算结果接收地址对应的终端设备之后,所述方法包括:
采用多种随机数加密方式加密所述目标随机数,得到密文;
将所述密文反馈至所述目标随机数对应的计算结果接收地址对应的终端设备。
综上所述,本实施例所述的随机数生成的方法,一方面,通过解析每个所述随机生成请求获取多个行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,在创建决策树的过程中,通过计算每个随机参数信息之间的时间差,快速的确定出所述决策树中每个节点的执行先后顺序,可以提高随机数生成的效率及行情指数信息的管理效率;另一方面,通过验证所述上一个节点的输出是否为下一个节点的输入,保证计算时串行的,形成计算的先后依赖关系,使得并行的加速设备无法缩短实际的运行时间,从而达到延时的目的,提高了计算过程中的安全性;最后,通过将所述行情指数信息生成包括执行条件的决策树,当满足执行条件时从所述决策树的根节点开始依次遍历所述决策树中的所有子节点,并调用延时函数,在生成目标随机数的流程中设定了一个延时函数计算,将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,避免了当发布者发现行情指数信息生成的随机数不利时随时修改行情指数信息的现象,提高了目标随机数的安全性。
实施例二
图2是本申请实施例二提供的随机数生成装置的结构图。
在一些实施例中,所述随机数生成装置20可以包括多个由程序代码段所组成的功能模块。所述随机数生成装置20中的各个程序段的程序代码可以存储于电子设备的存储器中,并由所述至少一个处理器所执行,以执行(详见图1描述)随机数生成的功能。
本实施例中,所述随机数生成装置20根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:接收模块201、解析模块202、调用模块203、检验模块204、输入模块205、生成模块206及检测模块207。本申请所称的模块是指一种能够 被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。在本实施例中,关于各模块的功能将在后续的实施例中详述。
接收模块201,用于接收客户端发送的随机数生成请求。
本实施例中,客户端在进行随机数获取时,通过客户端发起随机数生成请求,具体地,所述客户端可以是智能手机、IPAD或者其他设备,所述服务器可以为随机数生成系统,在进行随机数生成过程中,如所述客户端可以向随机数生成系统发送随机数生成请求,所述随机数生成系统用于接收所述客户端发送的随机数生成请求。
解析模块202,用于解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息。
本实施例中,在所述服务器接收到不同的客户端发送的多个行情指数信息,针对不同的行情指数信息生成不同的决策树,其中,每个决策树包含有执行条件,具体地,由于每个行情指数信息的发布时间不同,故在确定所述决策树的执行条件可以是到达指点时间。
在其他一些实施例中,所述决策树的执行条件也可以是到达指定状态。
在其他一些实施例中,所述行情指数信息中包括,但不限于随机数种子、多个随机参数信息。
可选地,所述解析模块202根据所述行情指数信息生成包括执行条件的决策树包括:
随机选取所述行情指数信息中的一个随机参数信息作为所述行情指数信息的决策树的根节点;
计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差;
判断是否存在与所述时间差相同的子节点;
当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;
当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点,其中,所述父节点处的随机参数信息与对应的所述子节点处的随机参数信息之间的时间差作为所述父节点和所述子节点之间的边的权重。
本实施例中,所述行情指数信息中包含有多个随机参数信息,随机选取一个随机参数信息作为所述行情指数信息的对应的决策树的根节点,然后计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差,根据所述时间差可以确定所述决策树中每个节点的执行顺序,当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点。
本实施例中,在根据所述行情指数信息中的多个随机参数信息创建决策树的过程中,通过计算每个随机参数信息之间的时间差,快速的确定出所述决策树中每个节点的执行先后顺序,可以提高随机数生成的效率及行情指数信息的管理效率。
调用模块203,用于当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数。
本实施例中,根据行情指数信息创建对应的决策树,并且每个决策树的执行条件不同,只有在满足执行条件的才进行对应的决策树的执行,提高了决策树的管理效率。
可选地,所述调用模块203监测所述行情指数信息是否满足所述执行条件包括:
监测所述行情指数信息对应的时间参数,其中,所述时间参数是根据所述行情指数的发布时间预先设置的;
判断所述时间参数是否达到预设的执行时间阈值;
当所述时间参数达到所述预设的执行时间阈值时,确定监测到所述行情指数信息满足所述执行条件;
当所述时间参数未达到所述预设的执行时间阈值时,确定监测到所述行情指数信息不满足所述执行条件。
示例性的,所述行情指数信息中包括记录所述行情指数的起始时刻,在起始时刻之后经过指定的时间参数,触发所述决策树执行。其中,所述指定的时间参数可以是客户端输入的时间参数,如60分钟;则在达到起始时刻后的60分钟时,触发所述决策树执行;所述指定的时间参数也可以是系统计算得到的时间参数,如客户端指定20:00执行决策树,所述起始时刻为18:00,则系统计算得到所述指定的时间参数为120分钟。当然,在其他一些实施例中,所述指定的时间参数也可以是通过动态计算得到的第一时间参数,这同样属于本公开的保护范围。
本实施例中,通过为每个决策树设置执行条件,避免在服务器接收的随机数生成请求较多时出现执行混乱的现象,提高了行情指数信息的管理效率,进而提高了随机数生成的效率及准确率。
本实施例中,在随机数生成系统中进行随机数生成的过程中,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数。
在其他可选的实施例中,所述调用模块203在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数包括:
从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数;
调用所述第一延时子函数对所述随机数种子和所述随机参数信息进行计算得到第一随机数。
本实施例中,所述延时函数中包含有多个延时子函数,并且每个子节点中的延时子函数不同,故在确定执行所述决策树时,首先从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数对所述随机数种子进行计算得到第一随机数。
检验模块204,用于通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点。
本实施例中,由于延时函数的每一个延时子函数的计算输出依赖于下一个延时子函数的输入,故在得到第一随机数之后,需要采用延时函数的验证算法检验所述第一随机数是否可以传输至所述根节点的下一个节点。
可选地,所述检验模块204通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点包括:
对所述第一随机数进行哈希运算,得到第一哈希值;
对所述根节点的下一个节点的随机参数信息中的目标随机参数进行哈希运算,得到第二哈希值;
判断所述第一哈希值与所述第二哈希值是否一致;
当所述第一哈希值与所述第二哈希值一致时,确定将所述第一随机数传输至所述根节点的下一个节点;或者
当所述第一哈希值与所述第二哈希值不一致时,确定不将所述第一随机数传输至所述根节点的下一个节点。
进一步地,当确定不将所述第一随机数传输至所述根节点的下一个节点之后,丢弃所述第一随机数。
本实施例中,通过哈希运算对所述第一随机数进行计算得到第一哈希值,对根节点的下一个节点中的目标随机参数进行计算得到第二哈希值,判断所述第一哈希值与所述第二哈希值是否一致,根据判断结果确定是否可以将所述第一随机数传输至所述根节点 的下一个节点,只有所述第一哈希值与所述第二哈希值一致时,确定所述第一随机数可以作为所述根节点的下一个节点的输入。
本实施例中,通过验证所述上一个节点的输出是否为下一个节点的输入,保证计算时串行的,形成计算的先后依赖关系,使得并行的加速设备无法缩短实际的运行时间,从而达到延时的目的,提高了计算过程中的安全性。
输入模块205,用于当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点。
本实施例中,由于决策树中包含有多个节点,每个节点的输入和输出存在依赖关系,故将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点。
可选地,所述输入模块205根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数包括:
从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数;
调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
本实施例中,每个随机参数信息中包含有延时子函数,从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数,并调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
生成模块206,用于根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
本实施例中,所述叶子节点为所述决策树的结束节点,当接收到所述叶子节点的上一个节点传输的目标随机数时,根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数,具体地,所述生成模块206根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数包括:
从所述叶子节点的随机参数信息中提取所述延时函数的目标延时子函数;
调用所述目标延时子函数对所述叶子节点接收到的随机数和所述叶子节点的随机参数信息进行计算得到目标随机数。
其中,所述目标随机数是指所述叶子节点的上一个节点根据所述叶子节点的上一个节点的上一个节点传输的随机数和所述叶子节点的上一个节点的随机参数信息生成的,避免了随机数种子被修改的现象,提高了生成的目标随机数的安全性。
本实施例中,通过将所述行情指数信息生成包括执行条件的决策树,当满足执行条件时从所述决策树的根节点开始依次遍历所述决策树中的所有子节点,并调用延时函数,在生成目标随机数的流程中设定了一个延时函数计算,将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,可以保证在经过所述延时函数计算之后,发布者无法立即知道随机数是什么,故无法评判随机数的利弊,只能将随机数种子放入延时函数中进行计算,等待计算结果,当所述计算结果出来时,已经经过了一个延时函数,就算对所述发布者不利,也无法进行更改,避免了当发布者发现行情指数信息生成的随机数不利时随时修改行情指数信息的现象,提高了目标随机数的安全性。
进一步地,在根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数之后,检测模块207用于检测所述目标随机数对应的叶子节点的地址是否 为所述行情指数信息中的计算结果接收地址;当所述目标随机数对应的叶子节点的地址为所述行情指数信息中的计算结果接收地址,将所述目标随机数反馈至所述计算结果接收地址对应的终端设备;当所述目标随机数对应的叶子节点的地址不为所述行情指数信息中的计算结果接收地址,丢弃所述目标随机数。
在其他一些实施例中,在将所述目标随机数反馈至计算结果接收地址对应的终端设备之后,采用多种随机数加密方式加密所述目标随机数,得到密文;将所述密文反馈至所述目标随机数对应的计算结果接收地址对应的终端设备。
综上所述,本实施例所述的随机数生成的装置,一方面,通过解析每个所述随机生成请求获取多个行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,在创建决策树的过程中,通过计算每个随机参数信息之间的时间差,快速的确定出所述决策树中每个节点的执行先后顺序,可以提高随机数生成的效率及行情指数信息的管理效率;另一方面,通过验证所述上一个节点的输出是否为下一个节点的输入,保证计算时串行的,形成计算的先后依赖关系,使得并行的加速设备无法缩短实际的运行时间,从而达到延时的目的,提高了计算过程中的安全性;最后,通过将所述行情指数信息生成包括执行条件的决策树,当满足执行条件时从所述决策树的根节点开始依次遍历所述决策树中的所有子节点,并调用延时函数,在生成目标随机数的流程中设定了一个延时函数计算,将上一个节点的计算得到的随机数作为下一个节点的延时子函数的输入,通过串行方式计算得到目标随机数,避免了当发布者发现行情指数信息生成的随机数不利时随时修改行情指数信息的现象,提高了目标随机数的安全性。
实施例三
参阅图3所示,为本申请实施例三提供的电子设备的结构示意图。在本申请较佳实施例中,所述电子设备3包括存储器31、至少一个处理器32、至少一条通信总线33及收发器34。
本领域技术人员应该了解,图3示出的电子设备的结构并不构成本申请实施例的限定,既可以是总线型结构,也可以是星形结构,所述电子设备3还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置。
在一些实施例中,所述电子设备3是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的电子设备,其硬件包括但不限于微处理器、专用集成电路、可编程门阵列、数字处理器及嵌入式设备等。所述电子设备3还可包括客户设备,所述客户设备包括但不限于任何一种可与客户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、数码相机等。
需要说明的是,所述电子设备3仅为举例,其他现有的或今后可能出现的电子产品如可适应于本申请,也应包含在本申请的保护范围以内,并以引用方式包含于此。
在一些实施例中,所述存储器31用于存储程序代码和各种数据,例如安装在所述电子设备3中的随机数生成装置20,并在电子设备3的运行过程中实现高速、自动地完成程序或数据的存取。所述存储器31包括只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子擦除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其他介质。
在一些实施例中,所述至少一个处理器32可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成, 包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述至少一个处理器32是所述电子设备3的控制核心(Control Unit),利用各种接口和线路连接整个电子设备3的各个部件,通过运行或执行存储在所述存储器31内的程序或者模块,以及调用存储在所述存储器31内的数据,以执行电子设备3的各种功能和处理数据。
在一些实施例中,所述至少一条通信总线33被设置为实现所述存储器31以及所述至少一个处理器32等之间的连接通信。
尽管未示出,所述电子设备3还可以包括给各个部件供电的电源(比如电池),可选的,电源可以通过电源管理装置与所述至少一个处理器32逻辑相连,从而通过电源管理装置实现管理充电、放电、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备3还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,电子设备,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的部分。
在进一步的实施例中,结合图2,所述至少一个处理器32可执行所述电子设备3的操作装置以及安装的各类应用程序(如所述的随机数生成装置20)、程序代码等,例如,上述的各个模块。
所述存储器31中存储有程序代码,且所述至少一个处理器32可调用所述存储器31中存储的程序代码以执行相关的功能。例如,图2中所述的各个模块是存储在所述存储器31中的程序代码,并由所述至少一个处理器32所执行,从而实现所述各个模块的功能以达到随机数生成的目的。
示例性的,所述程序代码可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器31中,并由所述处理器32执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述程序代码在所述电子设备3中的执行过程。例如,所述程序代码可以被分割成接收模块201、解析模块202、调用模块203、检验模块204、输入模块205、生成模块206及检测模块207。
在本申请的一个实施例中,所述存储器31存储多个计算机可读指令,所述多个计算机可读指令被所述至少一个处理器32所执行以实现随机数生成的功能。
具体地,所述至少一个处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
进一步地,所述计算机可读存储介质可以是非易失性,也可以是易失性。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,既可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或,单数不排除复数。本申请中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。
Claims (20)
- 一种随机数生成方法,其中,所述随机数生成方法包括:接收客户端发送的随机数生成请求;解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
- 如权利要求1所述的随机数生成方法,其中,所述在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数包括:从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数;调用所述第一延时子函数对所述随机数种子和所述随机参数信息进行计算得到第一随机数。
- 如权利要求1所述的随机数生成方法,其中,所述通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点包括:对所述第一随机数进行哈希运算,得到第一哈希值;对所述根节点的下一个节点的随机参数信息中的目标随机参数进行哈希运算,得到第二哈希值;判断所述第一哈希值与所述第二哈希值是否一致;当所述第一哈希值与所述第二哈希值一致时,确定将所述第一随机数传输至所述根节点的下一个节点;或者当所述第一哈希值与所述第二哈希值不一致时,确定不将所述第一随机数传输至所述根节点的下一个节点。
- 如权利要求1所述的随机数生成方法,其中,所述根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数包括:从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数;调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
- 如权利要求1所述的随机数生成方法,其中,所述在根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数之后,所述方法还包括:检测所述目标随机数对应的叶子节点的地址是否为所述行情指数信息中的计算结果接收地址;当所述目标随机数对应的叶子节点的地址为所述行情指数信息中的计算结果接收地址时,将所述目标随机数反馈至所述计算结果接收地址对应的终端设备;或者当所述目标随机数对应的叶子节点的地址不为每个行情指数信息中的计算结果接收地址时,丢弃所述目标随机数。
- 如权利要求1所述的随机数生成方法,其中,所述监测所述行情指数信息是否满足所述执行条件包括:监测所述行情指数信息对应的时间参数,其中,所述时间参数是根据所述行情指数的发 布时间预先设置的;判断所述时间参数是否达到预设的执行时间阈值;当所述时间参数达到所述预设的执行时间阈值时,确定监测到所述行情指数信息满足所述执行条件;当所述时间参数未达到所述预设的执行时间阈值时,确定监测到所述行情指数信息不满足所述执行条件。
- 如权利要求1所述的随机数生成方法,其中,所述根据所述行情指数信息生成包括执行条件的决策树包括:随机选取所述行情指数信息中的一个随机参数信息作为所述行情指数信息的决策树的根节点;计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差;判断是否存在与所述时间差相同的子节点;当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点,其中,所述父节点处的随机参数信息与对应的所述子节点处的随机参数信息之间的时间差作为所述父节点和所述子节点之间的边的权重。
- 一种电子设备,其中,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:接收客户端发送的随机数生成请求;解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
- 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数时,具体包括:从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数;调用所述第一延时子函数对所述随机数种子和所述随机参数信息进行计算得到第一随机数。
- 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点时,具体包括:对所述第一随机数进行哈希运算,得到第一哈希值;对所述根节点的下一个节点的随机参数信息中的目标随机参数进行哈希运算,得到第二哈希值;判断所述第一哈希值与所述第二哈希值是否一致;当所述第一哈希值与所述第二哈希值一致时,确定将所述第一随机数传输至所述根 节点的下一个节点;或者当所述第一哈希值与所述第二哈希值不一致时,确定不将所述第一随机数传输至所述根节点的下一个节点。
- 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数时,具体包括:从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数;调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
- 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述监测所述行情指数信息是否满足所述执行条件时,具体包括:监测所述行情指数信息对应的时间参数,其中,所述时间参数是根据所述行情指数的发布时间预先设置的;判断所述时间参数是否达到预设的执行时间阈值;当所述时间参数达到所述预设的执行时间阈值时,确定监测到所述行情指数信息满足所述执行条件;当所述时间参数未达到所述预设的执行时间阈值时,确定监测到所述行情指数信息不满足所述执行条件。
- 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述根据所述行情指数信息生成包括执行条件的决策树时,具体包括:随机选取所述行情指数信息中的一个随机参数信息作为所述行情指数信息的决策树的根节点;计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差;判断是否存在与所述时间差相同的子节点;当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点,其中,所述父节点处的随机参数信息与对应的所述子节点处的随机参数信息之间的时间差作为所述父节点和所述子节点之间的边的权重。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:接收客户端发送的随机数生成请求;解析所述随机生成请求得到行情指数信息,根据所述行情指数信息生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述在所述决策树的根节点中根据所述随机数种子和所述随机参数信息 生成第一随机数时,具体包括:从所述决策树的根节点的随机参数信息中提取所述延时函数的第一延时子函数;调用所述第一延时子函数对所述随机数种子和所述随机参数信息进行计算得到第一随机数。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点时,具体包括:对所述第一随机数进行哈希运算,得到第一哈希值;对所述根节点的下一个节点的随机参数信息中的目标随机参数进行哈希运算,得到第二哈希值;判断所述第一哈希值与所述第二哈希值是否一致;当所述第一哈希值与所述第二哈希值一致时,确定将所述第一随机数传输至所述根节点的下一个节点;或者当所述第一哈希值与所述第二哈希值不一致时,确定不将所述第一随机数传输至所述根节点的下一个节点。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数时,具体包括:从所述根节点的下一个节点的随机参数信息中提取所述延时函数的第二延时子函数;调用所述第二延时子函数对所述第一随机数和所述根节点的下一个节点的随机参数信息进行计算得到第二随机数。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述监测所述行情指数信息是否满足所述执行条件时,具体包括:监测所述行情指数信息对应的时间参数,其中,所述时间参数是根据所述行情指数的发布时间预先设置的;判断所述时间参数是否达到预设的执行时间阈值;当所述时间参数达到所述预设的执行时间阈值时,确定监测到所述行情指数信息满足所述执行条件;当所述时间参数未达到所述预设的执行时间阈值时,确定监测到所述行情指数信息不满足所述执行条件。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述根据所述行情指数信息生成包括执行条件的决策树时,具体包括:随机选取所述行情指数信息中的一个随机参数信息作为所述行情指数信息的决策树的根节点;计算其余任意一个随机参数信息与所述根节点处的随机参数信息之间的时间差;判断是否存在与所述时间差相同的子节点;当判断存在与所述时间差相同的子节点时,将所述子节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点;当判断不存在与所述时间差相同的子节点时,将所述根节点作为父节点,并将所述其余随机参数信息作为所述父节点的子节点,其中,所述父节点处的随机参数信息与对应的所述子节点处的随机参数信息之间的时间差作为所述父节点和所述子节点之间的边的权重。
- 一种随机数生成装置,其中,所述随机数生成装置包括:接收模块,用于接收客户端发送的随机数生成请求;解析模块,用于解析所述随机生成请求得到行情指数信息,根据所述行情指数信息 生成包括执行条件的决策树,其中,所述决策树的每个节点中包含有随机数种子和随机参数信息;调用模块,用于当监测到所述行情指数信息满足执行条件时,调用延时函数,在所述决策树的根节点中根据所述随机数种子和所述随机参数信息生成第一随机数;检验模块,用于通过所述延时函数的验证算法检验是否将所述第一随机数传输至所述根节点的下一个节点;输入模块,用于当确定将所述第一随机数传输至所述根节点的下一个节点时,将所述第一随机数输入至所述根节点的下一个节点,根据所述第一随机数和所述根节点的下一个节点的随机参数信息生成第二随机数,重复上述过程,直至所述下一个节点为叶子节点;生成模块,用于根据所述叶子节点的随机参数信息和所述叶子节点接收到的随机数生成目标随机数。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011594073.XA CN112631551B (zh) | 2020-12-29 | 2020-12-29 | 随机数生成方法、装置、电子设备及存储介质 |
| CN202011594073.X | 2020-12-29 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022142111A1 true WO2022142111A1 (zh) | 2022-07-07 |
Family
ID=75286247
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/096637 Ceased WO2022142111A1 (zh) | 2020-12-29 | 2021-05-28 | 随机数生成方法、装置、电子设备及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN112631551B (zh) |
| WO (1) | WO2022142111A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120428925A (zh) * | 2025-07-04 | 2025-08-05 | 深圳佰维存储科技股份有限公司 | 复写决策方法、装置、可读存储介质及电子设备 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112631551B (zh) * | 2020-12-29 | 2023-05-30 | 平安科技(深圳)有限公司 | 随机数生成方法、装置、电子设备及存储介质 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080085005A1 (en) * | 2006-09-29 | 2008-04-10 | Samsung Electronics Co., Ltd. | Method and apparatus for broadcast encryption using bilinear map |
| CN109660587A (zh) * | 2018-10-22 | 2019-04-19 | 平安科技(深圳)有限公司 | 基于随机数的数据推送方法、装置、存储介质及服务器 |
| CN110083386A (zh) * | 2019-04-04 | 2019-08-02 | 平安普惠企业管理有限公司 | 随机数产生控制方法、装置、计算机设备及存储介质 |
| CN110727414A (zh) * | 2019-09-30 | 2020-01-24 | 安徽问天量子科技股份有限公司 | 基于哈夫曼编码的随机数生成方法 |
| CN111600709A (zh) * | 2020-05-26 | 2020-08-28 | 牛津(海南)区块链研究院有限公司 | 可验证随机数的生成方法和装置 |
| CN112631551A (zh) * | 2020-12-29 | 2021-04-09 | 平安科技(深圳)有限公司 | 随机数生成方法、装置、电子设备及存储介质 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200167665A1 (en) * | 2019-07-01 | 2020-05-28 | Alibaba Group Holding Limited | Performing data processing based on decision tree |
| CN110457912B (zh) * | 2019-07-01 | 2020-08-14 | 阿里巴巴集团控股有限公司 | 数据处理方法、装置和电子设备 |
| CN110414567B (zh) * | 2019-07-01 | 2020-08-04 | 阿里巴巴集团控股有限公司 | 数据处理方法、装置和电子设备 |
| CN110351083A (zh) * | 2019-07-16 | 2019-10-18 | 深圳市网心科技有限公司 | 随机源生成方法、电子设备、系统及介质 |
| CN111443894A (zh) * | 2020-02-27 | 2020-07-24 | 山东爱城市网信息技术有限公司 | 一种基于区块链的随机数生成方法、设备及介质 |
-
2020
- 2020-12-29 CN CN202011594073.XA patent/CN112631551B/zh active Active
-
2021
- 2021-05-28 WO PCT/CN2021/096637 patent/WO2022142111A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080085005A1 (en) * | 2006-09-29 | 2008-04-10 | Samsung Electronics Co., Ltd. | Method and apparatus for broadcast encryption using bilinear map |
| CN109660587A (zh) * | 2018-10-22 | 2019-04-19 | 平安科技(深圳)有限公司 | 基于随机数的数据推送方法、装置、存储介质及服务器 |
| CN110083386A (zh) * | 2019-04-04 | 2019-08-02 | 平安普惠企业管理有限公司 | 随机数产生控制方法、装置、计算机设备及存储介质 |
| CN110727414A (zh) * | 2019-09-30 | 2020-01-24 | 安徽问天量子科技股份有限公司 | 基于哈夫曼编码的随机数生成方法 |
| CN111600709A (zh) * | 2020-05-26 | 2020-08-28 | 牛津(海南)区块链研究院有限公司 | 可验证随机数的生成方法和装置 |
| CN112631551A (zh) * | 2020-12-29 | 2021-04-09 | 平安科技(深圳)有限公司 | 随机数生成方法、装置、电子设备及存储介质 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120428925A (zh) * | 2025-07-04 | 2025-08-05 | 深圳佰维存储科技股份有限公司 | 复写决策方法、装置、可读存储介质及电子设备 |
| CN120428925B (zh) * | 2025-07-04 | 2025-10-17 | 深圳佰维存储科技股份有限公司 | 复写决策方法、装置、可读存储介质及电子设备 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112631551A (zh) | 2021-04-09 |
| CN112631551B (zh) | 2023-05-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2022088804A1 (zh) | 消息推送方法、装置、电子设备及存储介质 | |
| US10318727B2 (en) | Management device, management method, and computer-readable recording medium | |
| CN104298604B (zh) | 云服务健壮性测试系统及测试方法 | |
| CN112131002B (zh) | 数据管理方法及装置 | |
| CN113641544B (zh) | 用于检测应用状态的方法、装置、设备、介质和产品 | |
| WO2017028789A1 (zh) | 网络攻击检测方法和设备 | |
| CN102682245A (zh) | 用于检测与系统应用处理相关联的欺诈的系统和方法 | |
| CN109995523B (zh) | 激活码管理方法及装置、激活码生成方法及装置 | |
| US10489601B2 (en) | Encrypted extended system event log | |
| WO2020000716A1 (zh) | 大数据分析系统、服务器、数据处理方法、程序和存储介质 | |
| CN103379000A (zh) | 一种并发测试方法及测试服务器 | |
| CN105637510A (zh) | 基于缓存流的加速 | |
| WO2022142111A1 (zh) | 随机数生成方法、装置、电子设备及存储介质 | |
| CN114911817B (zh) | 一种数据处理方法、装置、电子设备及存储介质 | |
| CN110399719A (zh) | Bit文件加载方法、装置、设备及计算机可读存储介质 | |
| CN114201756B (zh) | 一种智能合约代码片段的漏洞检测方法和相关装置 | |
| CN114329488A (zh) | 内核函数的可信性验证方法、装置、电子设备及存储介质 | |
| CN113553098A (zh) | Flink SQL作业的提交方法、装置及计算机设备 | |
| CN116866422A (zh) | 实时推送涉敏信息并脱敏的方法、装置、设备及存储介质 | |
| CN115766014B (zh) | 一种控制器安全管理方法、装置、车辆及存储介质 | |
| WO2023060978A1 (zh) | Autosar软件的验证方法、装置、设备及存储介质 | |
| CN115712513A (zh) | 调用接口的方法、装置、电子设备及存储介质 | |
| CN107085681A (zh) | 鲁棒的计算设备标识框架 | |
| CN114978964A (zh) | 基于网络自检的通信公告配置方法、装置、设备及介质 | |
| US10915463B2 (en) | Synchronizing requests to access computing resources |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21912872 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21912872 Country of ref document: EP Kind code of ref document: A1 |