WO2017157197A1 - 随机数的生成及获取方法和装置 - Google Patents
随机数的生成及获取方法和装置 Download PDFInfo
- Publication number
- WO2017157197A1 WO2017157197A1 PCT/CN2017/075828 CN2017075828W WO2017157197A1 WO 2017157197 A1 WO2017157197 A1 WO 2017157197A1 CN 2017075828 W CN2017075828 W CN 2017075828W WO 2017157197 A1 WO2017157197 A1 WO 2017157197A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- random number
- storage unit
- random
- storage
- value
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/582—Pseudo-random number generators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30021—Compare instructions, e.g. Greater-Than, Equal-To, MINMAX
Definitions
- the present application relates to the field of computer technology, and in particular, to a method and an apparatus for generating and acquiring a random number.
- random numbers As random numbers become more widely used in the computer field, there is an increasing demand for random numbers generated.
- One is the software method, which uses the system time as the seed generated by the random number, and then generates a random number according to the system function.
- the other is a hardware method that designs a hardware device that generates random numbers and generates random numbers based on random signals.
- the software uses the system default random number generation method, which has the following disadvantages: if at the same time point (the same second, or the same millisecond), the random number repeat probability is high, resulting in an unbalanced random number distribution, that is, a pseudo random number. Because, in computer application systems, the use time is used as a seed for random number generation, and the random number produced in a short period of time, for example, in the same millisecond or second time period, is equal in number of time seeds. Therefore, the generated random number has the disadvantages of high repetition rate and uneven distribution.
- the purpose of the present application is to solve at least one of the above technical problems to some extent.
- the first object of the present application is to propose a method for generating a random number by randomly generating a random number storage array including N memory cells to store random numbers, and then randomly storing the memory cells in the random number storage array.
- the random number acquisition instruction is received, the random number is read from the corresponding storage unit in the random number storage array.
- the random number repetition rate that can be acquired multiple times in a short unit time is low. And the distribution is balanced, so the random number generation method of the present application has better randomness.
- a second object of the present application is to provide a device for generating a random number.
- the third object of the present application is to propose a method for obtaining a random number.
- a fourth object of the present application is to provide an apparatus for acquiring a random number.
- a method for generating a random number includes The following steps: generating a random number storage array, wherein the random number storage array includes N storage units, each of the storage units storing a random number, wherein N is a positive integer; storing the array in the random number The storage unit performs random shuffling; and receives the random number obtaining instruction, and reads the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the random number obtaining instruction.
- the random number generation method of the embodiment of the present application first generates a random number storage array including N storage units and each storage unit stores a random number, and then randomly mixes the storage units in the random number storage array, thereby Upon receiving the random number acquisition instruction, the random number stored in the storage unit is read from the corresponding storage unit in the random number storage array. Since the memory cells are randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number generation method of the present application has better randomness.
- the random numbers stored in the N storage units are all different.
- the method for generating a random number each of the storage units has an identification value
- the performing the shuffling of the storage units in the random number storage array specifically includes: The random function generates a random value, and generates an identifier value of the storage unit to be swapped according to the random value; and exchanges the random number in the storage unit to be swapped with the target storage unit according to the identifier value and the preset switching rule.
- the generating the random value according to the random function specifically includes: when i is greater than 1 and less than N, generating an ith random value according to the current time and the i-1th random value, where, i For the number of exchanges; when i is equal to 1, the ith random value is generated according to the current time.
- the preset switching rule is: when performing the ith switching, the storage unit corresponding to the i-th random value and the random number in the (N+1-i) storage unit Exchange.
- the reading the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the random number obtaining instruction specifically includes: acquiring according to the random number The instruction acquires an identifier value of the storage unit that has been currently read; and reads a random number stored in the next storage unit according to the identifier value of the currently read storage unit.
- a random number generating apparatus includes: a generating module, configured to generate a random number storage array, wherein the random number storage array includes N storage units Each of the storage units stores a random number, wherein N is a positive integer; a random shuffling module for randomly shuffling the storage units in the random number storage array; and a reading module for receiving Obtaining an instruction by a random number, and reading a random number stored by the storage unit from a corresponding storage unit in the random number storage array according to the random number obtaining instruction.
- the generating module first generates a random number storage array including N storage units and each storage unit stores a random number, and then the random shuffling module randomly performs the storage unit in the random number storage array.
- the shuffling so that the reading module can read the random number stored in the storage unit from the corresponding storage unit in the random number storage array when receiving the random number obtaining instruction. Since the random shuffling module randomly mixes the storage units in the random number storage array, the random number repetition rate obtained in a short unit time is low and the distribution is balanced. Therefore, the random number generating device of the present application has better randomness.
- the random numbers stored in the N storage units are all different.
- the random number generating device each of the storage units has an identification value
- the random shuffling module includes: an identifier value generating submodule, configured to generate according to a random function a random value, and generating an identifier value of the storage unit to be swapped according to the random value; and a sub-module for replacing the random number in the storage unit and the target storage unit according to the identifier value and the preset switching rule Exchange.
- the generating apparatus of the random number when i is greater than 1 and less than N, the identifier value generating sub-module generates an ith random according to the current time and the i-1th random value. a value, where i is the number of swaps; when i is equal to 1, the identifier value generation sub-module generates the i-th random value according to the current time.
- the preset switching rule is: when performing the ith switching, the storage unit corresponding to the i-th random value and the random number in the (N+1-i) storage unit Exchange.
- the reading module specifically includes: an obtaining submodule, configured to acquire an identifier value of a currently stored storage unit according to the random number obtaining instruction; and the reading submodule is configured to: Reading a random number stored in the next storage unit according to the identification value of the storage unit that has been currently read.
- a method for obtaining a random number includes the steps of: receiving a random number obtaining instruction, and acquiring a random number storage array, wherein the random number storage array includes N storage units, each of the storage units storing a random number, and the positions of the N storage units in the random number storage array are determined by random shuffling, wherein N is a positive integer; obtaining according to the random number
- the instruction acquires a random number stored by the storage unit from a corresponding storage unit in the random number storage array.
- the random number obtaining method of the embodiment of the present application first receives the random number obtaining instruction, and then acquires the random number storage array and determines the position of the N storage units in the random number storage array by random shuffling, thereby receiving the random number according to the random number
- the fetch instruction reads the random number stored in the storage unit from the corresponding storage unit in the random number storage array. Since the memory cells are randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number acquisition method of the present application has better randomness.
- the random numbers stored in the N storage units are all different.
- the method for acquiring a random number each of the storage units has an identification value, wherein a location of the N storage units in the random number storage array is randomized by the following steps The arranging: generating a random value according to the random function, and generating an identifier value of the storage unit to be swapped according to the random value; and randomly selecting the storage unit to be swapped and the target storage unit according to the identifier value and the preset switching rule The number is exchanged.
- the obtaining the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the random number obtaining instruction specifically includes: acquiring an instruction according to the random number Obtaining an identifier value of the storage unit that has been currently read; acquiring a random number stored in the next storage unit according to the identifier value of the currently read storage unit.
- a random number obtaining apparatus includes: a receiving module, configured to receive a random number obtaining instruction; and a random number storage array acquiring module, configured to obtain a random number storage An array, wherein the random number storage array includes N storage units, each of the storage units stores a random number, and positions of the N storage units in the random number storage array are determined by random shuffling, wherein N is a positive integer; a random number obtaining module is configured to acquire, according to the random number obtaining instruction, a random number stored by the storage unit from a corresponding storage unit in the random number storage array.
- the receiving module first receives the random number obtaining instruction, and then the random number storage array obtaining module acquires the random number storage array and determines the N storage units in the random number storage array by random shuffling. Position, so that the random number obtaining module reads the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the received random number obtaining instruction. Since the memory cells are randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number acquisition device of the present application has better randomness.
- the random numbers stored in the N storage units are all different.
- the random number obtaining module specifically includes: a first obtaining submodule, configured to acquire, according to the random number obtaining instruction, an identifier value of a storage unit that has been currently read; And a module, configured to acquire a random number stored by the next storage unit according to the identifier value of the currently read storage unit.
- FIG. 1 is a flowchart of a method for generating a random number according to an embodiment of the present application
- FIG. 3 is a flow chart of a method for randomly shuffling memory cells in a random number storage array according to an embodiment of the present application
- FIG. 4 is a schematic structural diagram of a device for generating a random number according to an embodiment of the present application
- FIG. 5 is a schematic structural diagram of a device for generating a random number according to another embodiment of the present application.
- FIG. 6 is a schematic structural diagram of a device for generating a random number according to still another embodiment of the present application.
- FIG. 7 is a flowchart of a method for acquiring a random number according to an embodiment of the present application.
- FIG. 8 is a schematic structural diagram of a device for acquiring a random number according to an embodiment of the present application.
- FIG. 9 is a schematic structural diagram of an apparatus for acquiring a random number according to another embodiment of the present application.
- the present invention randomizes the storage units in the random number storage array by random shuffling, so that the random number sequence in the random number storage array is completely random, thereby solving the problem that the random probability of the traditional random function is repeated and the distribution is unbalanced.
- the problem When a random number needs to be obtained, the corresponding random number can be obtained from the random number storage array.
- FIG. 1 is a flow chart of a method of generating a random number according to an embodiment of the present application.
- the method for generating a random number in the embodiment of the present application includes the following steps:
- the random numbers stored in the N storage units are all different.
- the random number stored in the corresponding storage unit in the generated random number storage array is not repeated. For example, if one random number stored in one storage unit is 2, then other storage units are The stored random numbers are not 2.
- N storage units may store 1 to N integers, respectively, so that each storage list The random number stored in the meta is different from the others.
- the length of the random number storage array is configurable, and the length of the random number storage array is set in advance as needed.
- S120 Perform random mixing on the storage units in the random number storage array.
- the random shuffling in the embodiment of the present application refers to randomly changing the random numbers stored in the N storage units in the random number storage array, so that the order of the random numbers stored in the storage unit is completely random, thereby Solving the problem that the random probability of the random function in the prior art is repeated causes the distribution to be unbalanced.
- the random numbers stored in the N storage units may be randomly exchanged in various manners, which will be described in detail in the following embodiments.
- the random numbers stored in the random number storage array may be randomly mixed in a plurality of manners, so that the order of the random numbers is completely random, and thus is not limited to the following embodiments of the present application. Any algorithm that can achieve the above purpose should be included in the protection scope of the present application.
- the corresponding random number may be sequentially read from the random number storage array, or may be randomly read from the random number storage array. Random number.
- the corresponding random number can also be read from the random number storage array in other manners.
- the identifier value of the currently read storage unit is acquired according to the random number acquisition instruction (ie, the storage unit that was last read)
- the identification value reads the random number stored in the next storage unit according to the identification value of the storage unit that has been read.
- step S110 After each receiving the random number acquisition instruction, it is further determined whether the storage unit that has been read is the last storage unit in the random number storage array. If it is not the last memory location in the random number storage array, continue reading the random number stored in the next memory location. If it is the last storage unit in the random number storage array, it is necessary to regenerate the new random number storage array, that is, step S110 is performed.
- the method for generating a random number in the embodiment of the present application first generates a random number storage array including N storage units and each storage unit stores a random number, and then randomly mixes the storage units in the random number storage array, thereby Upon receiving the random number acquisition instruction, the random number stored in the storage unit is read from the corresponding storage unit in the random number storage array. Since the storage unit is randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced, so the random number of the present application The method has good randomness.
- the currently stored memory cell is the last memory cell in the random number storage array. If it is not the last memory location in the random number storage array, continue reading the random number stored in the next memory location.
- the storage unit that has been read is the last one of the random number storage array, that is, the random number stored in all the storage units in the random number storage array has been read, and the storage array needs to be stored for the random number.
- the random number stored by the storage unit is directly read from the corresponding storage unit in the random number storage array according to the random number acquisition instruction.
- the location of each storage unit in the random number storage array is cyclically scrambled, so that the order of the random numbers stored in the storage unit can be completely random, thereby solving the large probability of the random function in the prior art. There is a problem that the repetition causes the distribution to be unbalanced.
- the random numbers stored in the N storage units may be randomly exchanged in a plurality of manners, so that the order of the random numbers is completely random, and thus is not limited to the embodiment of the present application.
- the identifier value of the storage unit that has been read (ie, the identifier value of the storage unit that was read last time) is obtained according to the random number acquisition instruction, and is read according to the identifier value of the storage unit that has been read currently.
- a random number stored by a storage unit for example, can be read sequentially.
- the corresponding random number can also be read from the random number storage array in other manners, and the corresponding random numbers are sequentially read from the random number storage array in sequence without being limited to the embodiment of the present application.
- First initialize a random number storage array define the storage unit to get the identity value and the random number storage array length. After receiving the random number instruction, determining whether the current storage unit stores the last one of the random number storage array, and determining that the current storage unit is not the last one of the random number storage array, it is necessary to regenerate the random number storage array, and then loop the random number storage array. The storage units in the order are scrambled. Finally, according to the identification value of the storage unit acquired last time, the data stored in the next storage unit in the random number storage array is selected as the current random number to be acquired.
- the method for generating the random number of the present application is not limited to being implemented based on the JAVA language, and may be implemented using other computer languages.
- the method for generating a random number in the embodiment of the present application first generates a random number storage array including N storage units and each storage unit stores a random number, and then randomly mixes the storage units in the random number storage array, thereby Upon receiving the random number acquisition instruction, the random number stored in the storage unit is read from the corresponding storage unit in the random number storage array. Since the storage unit is randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number generation method of the present application has a comparative method. Good randomness.
- each storage unit has an identification value.
- the identifier value is an identifier used to distinguish the storage unit.
- the identifier value of the storage unit may be equal to the random number stored in the storage unit in the initial state (ie, before random shuffling).
- the random value generated in the step S310 is not the same as the concept of the random number stored in the storage unit, and the random value generated in the step is used to determine the identifier value of the storage unit to be swapped.
- the i-th random value is generated according to the current time and the i-1th random value; and when i is equal to 1, the i-th random value is generated according to the current time, where i is the number of exchanges. That is to say, when the random value is generated for the first time, a random value is generated according to the current time, and when the random value is not generated for the first time, the i-th random value is generated according to the current time and the i-1th random value.
- each storage unit after generating the random number storage array, each storage unit has an identification value, generates a random value according to the random function, and generates an identification value of the storage unit to be exchanged according to the random value, thereby determining the storage unit that needs to be exchanged.
- the storage unit corresponding to the i-th random value is exchanged with the random number in the (N+1-i)th storage unit.
- each storage unit has an identification value, and the identification value can distinguish different storage units.
- i 1
- the first random value is generated according to the current time
- the identifier value of the storage unit to be exchanged is generated according to the first random value
- the random number in the N storage unit is exchanged, that is, the random number in the storage unit corresponding to the first random value is stored in the Nth storage unit, and the random number in the Nth storage unit is stored in the first random value.
- the second random value is generated according to the current time and the first random value
- the identification value of the storage unit to be exchanged is generated according to the second random value
- the second random value is obtained according to the preset exchange rule.
- the corresponding storage unit and the random number in the N-1th storage unit are exchanged, that is, the random number in the storage unit corresponding to the second random value is stored in the N-1th storage unit, and the N-1th storage unit is The random number in the storage is stored in the storage unit corresponding to the second random value. This loops until the random numbers stored in the storage locations in all random number storage arrays are swapped.
- the storage unit of the identification value calculated by the first time is exchanged with the Nth storage unit. In other embodiments of the present application, the switching may also be started from the first storage unit.
- the method for changing the random number in the storage unit in the embodiment of the present application is only one type of the preset switching rule, that is, the preset switching rule can be set according to actual needs, and the storage method is stored through different switching methods. The random number in the unit is swapped.
- the identity value of the cell reads the random number stored in the next memory location.
- the method for generating a random number in the embodiment of the present application first generates a random number storage array including N storage units and each storage unit stores a random number, and then randomly mixes the storage units in the random number storage array, thereby Upon receiving the random number acquisition instruction, the random number stored in the storage unit is read from the corresponding storage unit in the random number storage array. Since the storage unit is randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number generation method of the present application has a comparative method. Good randomness.
- an embodiment of the present invention further provides a random number generating apparatus, which is provided by the random number generating apparatus provided by the embodiment of the present invention and the random number provided by the foregoing several embodiments.
- the generation method has the same or similar technical features, and therefore the implementation of the foregoing random number generation method is also applicable to the random number generation apparatus provided in this embodiment, which will not be described in detail in this embodiment.
- the random number generating device may include: a generating module 110, a random shuffling module 120, and a reading module 130.
- the generating module 110 is configured to generate a random number storage array, wherein the random number storage array includes N storage units, and each storage unit stores a random number, where N is a positive integer.
- the random numbers stored in the N storage units are all different.
- the random shuffling module 120 is configured to randomly mix the storage units in the random number storage array.
- the reading module 130 is configured to receive the random number obtaining instruction, and read the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the random number obtaining instruction.
- FIG. 5 is a schematic structural diagram of a random number generating apparatus according to another embodiment of the present application, that is, as shown in FIG.
- the 120 specifically includes an identifier value generating submodule 1201 and a swap submodule 1202.
- the identifier value generating sub-module 1201 is configured to generate a random value according to a random function, and generate an identifier value of the storage unit to be swapped according to the random value.
- the switching sub-module 1202 is configured to exchange the random number in the storage unit to be replaced with the target storage unit according to the identifier value and the preset switching rule.
- the identifier value generation sub-module 1201 when i is greater than 1 and less than N, the identifier value generation sub-module 1201 generates an i-th random value according to the current time and the i-1th random value, where i is the number of exchanges. When i is equal to 1, the identification value generation sub-module 1201 generates an i-th random value according to the current time.
- the preset switching rule is: when the i-th exchange is performed, the storage unit corresponding to the i-th random value is exchanged with the random number in the (N+1-i) storage unit. .
- determining whether the current storage unit is The machine counts the last one of the arrays. If it is not the last storage unit in the random number storage array, it continues to read the random number stored in the next storage unit. If it is the last storage unit in the random number storage array, you need to regenerate the new random number storage array.
- FIG. 6 is a schematic structural diagram of a device for generating a random number according to another embodiment of the present application.
- the reading module 130 specifically includes: acquiring the submodule 1301. And reading sub-module 1302.
- the obtaining submodule 1301 is configured to acquire an identifier value of a storage unit that has been currently read according to the random number obtaining instruction.
- the reading sub-module 1302 is configured to read the random number stored in the next storage unit according to the identification value of the storage unit that has been currently read.
- the generating module first generates a random number storage array including N storage units and each storage unit stores a random number, and then the random shuffling module randomly performs the storage unit in the random number storage array.
- the shuffling so that the reading module can read the random number stored in the storage unit from the corresponding storage unit in the random number storage array when receiving the random number obtaining instruction. Since the random shuffling module randomly mixes the storage units in the random number storage array, the random number repetition rate obtained in a short unit time is low and the distribution is balanced. Therefore, the random number generating device of the present application has better randomness.
- FIG. 7 is a flowchart of a method for acquiring a random number according to an embodiment of the present application.
- the method for obtaining a random number shown in the embodiment of the present application is described from the aspect of acquisition.
- the method for acquiring the random number includes the following steps.
- the random numbers stored in the N storage units are all different.
- the N storage units may respectively store 1 to N integers, so that the random numbers stored in each storage unit are different from others.
- the length of the random number storage array is configurable, and the length of the random number storage array is set in advance as needed.
- each storage unit after generating the random number storage array, each storage unit has an identification value, generates a random value according to the random function, and generates an identification value of the storage unit to be exchanged according to the random value, thereby determining the storage unit that needs to be exchanged.
- the storage unit and the target storage list are to be exchanged according to the identifier value and the preset exchange rule.
- the random number in the meta is exchanged.
- the method for changing the random number in the storage unit in the embodiment of the present application is only one type of the preset switching rule, that is, the preset switching rule can be set according to actual needs, and the storage method is stored through different switching methods. The random number in the unit is swapped.
- the identifier value of the currently read storage unit is acquired according to the random number acquisition instruction (ie, the storage unit that was last read)
- the identification value reads the random number stored in the next storage unit according to the identification value of the storage unit that has been read.
- the random number obtaining method of the embodiment of the present application first receives a random number obtaining instruction, and then acquires a random number storage array and determines a position of the N storage units in the random number storage array by random shuffling, thereby acquiring according to the received random number.
- the instruction reads the random number stored by the storage unit from the corresponding storage unit in the random number storage array. Since the memory cells are randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number acquisition method of the present application has better randomness.
- an embodiment of the present invention further provides a random number obtaining apparatus, which is provided by the random number obtaining apparatus provided by the embodiment of the present invention and the random number provided by the foregoing several embodiments.
- the acquisition method has the same or similar technical features. Therefore, the implementation of the foregoing random number acquisition method is also applicable to the random number acquisition apparatus provided in this embodiment, which is not described in detail in this embodiment.
- the acquisition device of the random number may include: a receiving module 210, a random number storage array obtaining module 220, and a random number obtaining module 230.
- the receiving module 210 is configured to receive a random number obtaining instruction.
- the random number storage array obtaining module 220 is configured to obtain a random number storage array, wherein the random number storage array includes N storage units, each storage unit stores a random number, and the location of the N storage units in the random number storage array passes Random mixing is determined, where N is a positive integer.
- the random numbers stored in the N storage units are all different.
- the random number obtaining module 230 is configured to obtain, from the corresponding storage unit in the random number storage array, the random number stored by the storage unit according to the random number obtaining instruction.
- FIG. 9 is a schematic structural diagram of a device for acquiring a random number according to another embodiment of the present application, that is, as shown in FIG. 230 specifically includes a first obtaining submodule 2301 for acquiring an identifier value of a storage unit that has been currently read according to the random number obtaining instruction.
- First The second obtaining sub-module 2302 is configured to acquire a random number stored by the next storage unit according to the identifier value of the storage unit that has been currently read.
- the receiving module receives the random number obtaining instruction, and then the random number storage array obtaining module acquires the random number storage array and determines the position of the N storage units in the random number storage array by random shuffling. And the random number obtaining module reads the random number stored by the storage unit from the corresponding storage unit in the random number storage array according to the received random number obtaining instruction. Since the memory cells are randomly mixed in the random number storage array, the random number of the random number acquired in a short unit time is low, and the distribution is balanced. Therefore, the random number acquisition device of the present application has better randomness.
- first and second are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated.
- features defining “first” or “second” may include at least one of the features, either explicitly or implicitly.
- the meaning of "a plurality” is at least two, such as two, three, etc., unless specifically defined otherwise.
- portions of the application can be implemented in hardware, software, firmware, or a combination thereof.
- multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
- a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
- each functional unit in each embodiment of the present application may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
- the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
- the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
- the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like. While the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are illustrative and are not to be construed as limiting the scope of the present application. The embodiments are subject to variations, modifications, substitutions and variations.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Analysis (AREA)
- Pure & Applied Mathematics (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Software Systems (AREA)
- Indexing, Searching, Synchronizing, And The Amount Of Synchronization Travel Of Record Carriers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Storage Device Security (AREA)
- Read Only Memory (AREA)
Abstract
Description
Claims (19)
- 一种随机数的生成方法,其特征在于,包括以下步骤:生成随机数存储数组,其中,所述随机数存储数组包括N个存储单元,每个所述存储单元存储一个随机数,其中,N为正整数;对所述随机数存储数组中的存储单元进行随机混排;以及接收随机数获取指令,并根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中读取所述存储单元存储的随机数。
- 如权利要求1所述的随机数的生成方法,其特征在于,所述N个存储单元中存储的随机数均不相同。
- 如权利要求1所述的随机数的生成方法,其特征在于,每个所述存储单元具有标识值,其中,所述对所述随机数存储数组中的存储单元进行随机混排具体包括:根据随机函数生成随机值,并根据所述随机值生成待调换存储单元的标识值;以及根据所述标识值和预设调换规则将所述待调换存储单元与目标存储单元中的随机数进行调换。
- 如权利要求3所述的随机数的生成方法,其特征在于,所述根据随机函数生成随机值具体包括:当i大于1且小于N时,根据当前时间和第i-1次随机值生成第i次随机值,其中,i为调换次数;当i等于1时,根据当前时间生成所述第i次随机值。
- 如权利要求3所述的随机数的生成方法,其特征在于,所述预设调换规则为:当进行第i次调换时,将第i次随机值对应的存储单元与第(N+1-i)存储单元中的随机数进行调换。
- 如权利要求1所述的随机数的生成方法,其特征在于,所述根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中读取所述存储单元存储的随机数具体包括:根据所述随机数获取指令获取当前已被读取的存储单元的标识值;根据所述当前已被读取的存储单元的标识值读取下一个存储单元存储的随机数。
- 一种随机数的生成装置,其特征在于,包括:生成模块,用于生成随机数存储数组,其中,所述随机数存储数组包括N个存储单元,每个所述存储单元存储一个随机数,其中,N为正整数;随机混排模块,用于对所述随机数存储数组中的存储单元进行随机混排;以及读取模块,用于接收随机数获取指令,并根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中读取所述存储单元存储的随机数。
- 如权利要求7所述的随机数的生成装置,其特征在于,所述N个存储单元中存储的随机数均不相同。
- 如权利要求7所述的随机数的生成装置,其特征在于,每个所述存储单元具有标识值,其中,所述随机混排模块包括:标识值生成子模块,用于根据随机函数生成随机值,并根据所述随机值生成待调换存储单元的标识值;以及调换子模块,用于根据所述标识值和预设调换规则将所述待调换存储单元与目标存储单元中的随机数进行调换。
- 如权利要求9所述的随机数的生成装置,其特征在于,当i大于1且小于N时,所述标识值生成子模块根据当前时间和第i-1次随机值生成第i次随机值,其中,i为调换次数;当i等于1时,所述标识值生成子模块根据当前时间生成所述第i次随机值。
- 如权利要求9所述的随机数的生成装置,其特征在于,所述预设调换规则为:当进行第i次调换时,将第i次随机值对应的存储单元与第(N+1-i)存储单元中的随机数进行调换。
- 如权利要求7所述的随机数的生成装置,其特征在于,所述读取模块具体包括:获取子模块,用于根据所述随机数获取指令获取当前已被读取的存储单元的标识值;读取子模块,用于根据所述当前已被读取的存储单元的标识值读取下一个存储单元存储的随机数。
- 一种随机数的获取方法,其特征在于,包括以下步骤:接收随机数获取指令,并获取随机数存储数组,其中,所述随机数存储数组包括N个存储单元,每个所述存储单元存储一个随机数,且所述随机数存储数组中的N个存储单元的位置通过随机混排确定,其中,N为正整数;根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中获取所述存储单元存储的随机数。
- 如权利要求13所述的随机数的获取方法,其特征在于,所述N个存储单元中存储的随机数均不相同。
- 如权利要求13所述的随机数的获取方法,其特征在于,每个所述存储单元具 有标识值,其中,通过以下步骤对所述随机数存储数组中的N个存储单元的位置通过随机混排:根据随机函数生成随机值,并根据所述随机值生成待调换存储单元的标识值;以及根据所述标识值和预设调换规则将所述待调换存储单元与目标存储单元中的随机数进行调换。
- 如权利要求13所述的随机数的获取方法,其特征在于,所述根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中获取所述存储单元存储的随机数具体包括:根据所述随机数获取指令获取当前已被读取的存储单元的标识值;根据所述当前已被读取的存储单元的标识值获取下一个存储单元存储的随机数。
- 一种随机数的获取装置,其特征在于,包括:接收模块,用于接收随机数获取指令;随机数存储数组获取模块,用于获取随机数存储数组,其中,所述随机数存储数组包括N个存储单元,每个所述存储单元存储一个随机数,且所述随机数存储数组中的N个存储单元的位置通过随机混排确定,其中,N为正整数;随机数获取模块,用于根据所述随机数获取指令从所述随机数存储数组中对应的存储单元中获取所述存储单元存储的随机数。
- 如权利要求17所述的随机数的获取装置,其特征在于,所述N个存储单元中存储的随机数均不相同。
- 如权利要求17所述的随机数的获取装置,其特征在于,所述随机数获取模块具体包括:第一获取子模块,用于根据所述随机数获取指令获取当前已被读取的存储单元的标识值;第二获取子模块,用于根据所述当前已被读取的存储单元的标识值获取下一个存储单元存储的随机数。
Priority Applications (8)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP17765739.2A EP3432137B1 (en) | 2016-03-17 | 2017-03-07 | Random number generation and acquisition method and device |
ES17765739T ES2847287T3 (es) | 2016-03-17 | 2017-03-07 | Método y dispositivo de generación y adquisición de números aleatorios |
PL17765739T PL3432137T3 (pl) | 2016-03-17 | 2017-03-07 | Sposób i urządzenie do generowania i pozyskiwania liczb losowych |
EP20189059.7A EP3751410B1 (en) | 2016-03-17 | 2017-03-07 | Random number generation and acquisition method and device |
JP2018549163A JP6793747B2 (ja) | 2016-03-17 | 2017-03-07 | 乱数生成及び取得の方法及びデバイス |
US16/131,352 US10691415B2 (en) | 2016-03-17 | 2018-09-14 | Random number generation and acquisition method and device |
US16/906,840 US10929103B2 (en) | 2016-03-17 | 2020-06-19 | Random number generation and acquisition method and device |
US17/181,978 US11182129B2 (en) | 2016-03-17 | 2021-02-22 | Random number generation and acquisition method and device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610152995.2 | 2016-03-17 | ||
CN201610152995.2A CN107203365B (zh) | 2016-03-17 | 2016-03-17 | 随机数的生成及获取方法和装置 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/131,352 Continuation US10691415B2 (en) | 2016-03-17 | 2018-09-14 | Random number generation and acquisition method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017157197A1 true WO2017157197A1 (zh) | 2017-09-21 |
Family
ID=59850088
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/075828 WO2017157197A1 (zh) | 2016-03-17 | 2017-03-07 | 随机数的生成及获取方法和装置 |
Country Status (8)
Country | Link |
---|---|
US (3) | US10691415B2 (zh) |
EP (2) | EP3751410B1 (zh) |
JP (1) | JP6793747B2 (zh) |
CN (1) | CN107203365B (zh) |
ES (1) | ES2847287T3 (zh) |
PL (1) | PL3432137T3 (zh) |
TW (1) | TWI671645B (zh) |
WO (1) | WO2017157197A1 (zh) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107203365B (zh) | 2016-03-17 | 2020-09-08 | 阿里巴巴集团控股有限公司 | 随机数的生成及获取方法和装置 |
CN110390855A (zh) * | 2018-04-16 | 2019-10-29 | 王金环 | 一种基于双重随机算法的课堂提问与计分系统 |
CN110647287A (zh) * | 2018-06-26 | 2020-01-03 | 北京兆易创新科技股份有限公司 | 存储器的数据存储方法、装置、电子设备和存储介质 |
CN110069242A (zh) * | 2019-04-26 | 2019-07-30 | 迅付信息科技有限公司 | 一种随机数发生器及电子券、动态支付码的生成方法 |
CN110505523B (zh) * | 2019-09-24 | 2020-06-30 | 广州优视云集科技有限公司 | 一种视频转码优先级顺序控制方法及处理终端 |
CN113138751B (zh) * | 2020-01-17 | 2023-06-09 | 北京新能源汽车股份有限公司 | 一种随机数的处理方法、装置及汽车 |
JP7446923B2 (ja) * | 2020-06-02 | 2024-03-11 | キオクシア株式会社 | 半導体装置及び半導体記憶装置 |
CN111966844B (zh) * | 2020-08-17 | 2023-09-26 | 北京像素软件科技股份有限公司 | 一种对象的加载方法、装置及存储介质 |
CN113157249B (zh) * | 2021-04-22 | 2023-09-08 | 北京奇艺世纪科技有限公司 | 标识号生成方法、装置、电子设备及存储介质 |
CN113485676A (zh) * | 2021-07-08 | 2021-10-08 | 上海通联金融服务有限公司 | 随机生成信用卡号的方法及系统 |
US20230205531A1 (en) * | 2021-12-23 | 2023-06-29 | Intel Corporation | Random data usage |
CN117827148B (zh) * | 2023-12-30 | 2024-09-17 | 北京海泰方圆科技股份有限公司 | 一种随机数生成方法、装置及电子设备 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006155168A (ja) * | 2004-11-29 | 2006-06-15 | Hitachi Ltd | 乱数生成方法及びシステム |
CN101105742A (zh) * | 2006-07-10 | 2008-01-16 | 致伸科技股份有限公司 | 随机数产生器及随机数产生方法 |
CN101636714A (zh) * | 2007-11-20 | 2010-01-27 | 董际国 | 随机数产生装置和方法 |
CN102541508A (zh) * | 2010-12-29 | 2012-07-04 | 鸿富锦精密工业(深圳)有限公司 | 真随机数产生系统及方法 |
CN103034471A (zh) * | 2012-12-10 | 2013-04-10 | 杜海洋 | 一种随机数的生成方法及系统 |
CN103645882A (zh) * | 2013-12-09 | 2014-03-19 | 中颖电子股份有限公司 | 基于单片机的批量乱序随机数的生成方法 |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1153173A (ja) | 1997-08-07 | 1999-02-26 | Nec Corp | 擬似乱数発生方法及び装置 |
US6760739B2 (en) * | 2001-03-01 | 2004-07-06 | Corrent Corporation | Pipelined digital randomizer based on permutation and substitution using data sampling with variable frequency and non-coherent clock sources |
US7197142B2 (en) * | 2001-08-24 | 2007-03-27 | Alten Alexander I | System and methods for a vernam stream cipher |
FR2829643A1 (fr) * | 2001-09-12 | 2003-03-14 | Everbee Wireless Ltd | Procede pour generer des nombres aleatoires |
US7236996B2 (en) * | 2003-12-05 | 2007-06-26 | John McCann | Methods for generating random numbers |
JP2005228169A (ja) | 2004-02-16 | 2005-08-25 | Bittech Inc | 乱数生成装置 |
WO2008053936A1 (fr) * | 2006-10-31 | 2008-05-08 | Kiyoto Yui | Dispositif de génération de nombres pseudo-aléatoires, programme de génération de nombres pseudo-aléatoires, et support contenant un programme de génération de nombres pseudo-aléatoires |
US20100005133A1 (en) * | 2008-07-04 | 2010-01-07 | Samsung Electronics Co. Ltd. | Apparatus and method for generating permutation sequence in a broadband wireless communication system |
JP5813380B2 (ja) * | 2011-06-03 | 2015-11-17 | 株式会社東芝 | 半導体記憶装置 |
US8843539B2 (en) * | 2012-05-08 | 2014-09-23 | Caringo, Inc. | Generation of seed value for pseudo random number generator |
CN104506319B (zh) * | 2014-12-15 | 2017-11-28 | 飞天诚信科技股份有限公司 | 一种多种子动态令牌的工作方法 |
CN107203365B (zh) | 2016-03-17 | 2020-09-08 | 阿里巴巴集团控股有限公司 | 随机数的生成及获取方法和装置 |
JP7299740B2 (ja) | 2019-04-08 | 2023-06-28 | キヤノン株式会社 | シート撮像装置、シート判別装置および画像形成装置 |
-
2016
- 2016-03-17 CN CN201610152995.2A patent/CN107203365B/zh active Active
-
2017
- 2017-01-19 TW TW106101909A patent/TWI671645B/zh active
- 2017-03-07 EP EP20189059.7A patent/EP3751410B1/en active Active
- 2017-03-07 JP JP2018549163A patent/JP6793747B2/ja active Active
- 2017-03-07 WO PCT/CN2017/075828 patent/WO2017157197A1/zh active Application Filing
- 2017-03-07 EP EP17765739.2A patent/EP3432137B1/en active Active
- 2017-03-07 PL PL17765739T patent/PL3432137T3/pl unknown
- 2017-03-07 ES ES17765739T patent/ES2847287T3/es active Active
-
2018
- 2018-09-14 US US16/131,352 patent/US10691415B2/en active Active
-
2020
- 2020-06-19 US US16/906,840 patent/US10929103B2/en active Active
-
2021
- 2021-02-22 US US17/181,978 patent/US11182129B2/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006155168A (ja) * | 2004-11-29 | 2006-06-15 | Hitachi Ltd | 乱数生成方法及びシステム |
CN101105742A (zh) * | 2006-07-10 | 2008-01-16 | 致伸科技股份有限公司 | 随机数产生器及随机数产生方法 |
CN101636714A (zh) * | 2007-11-20 | 2010-01-27 | 董际国 | 随机数产生装置和方法 |
CN102541508A (zh) * | 2010-12-29 | 2012-07-04 | 鸿富锦精密工业(深圳)有限公司 | 真随机数产生系统及方法 |
CN103034471A (zh) * | 2012-12-10 | 2013-04-10 | 杜海洋 | 一种随机数的生成方法及系统 |
CN103645882A (zh) * | 2013-12-09 | 2014-03-19 | 中颖电子股份有限公司 | 基于单片机的批量乱序随机数的生成方法 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3432137A4 * |
Also Published As
Publication number | Publication date |
---|---|
CN107203365A (zh) | 2017-09-26 |
US11182129B2 (en) | 2021-11-23 |
PL3432137T3 (pl) | 2021-08-02 |
CN107203365B (zh) | 2020-09-08 |
EP3432137B1 (en) | 2020-10-14 |
EP3751410B1 (en) | 2022-01-26 |
US10691415B2 (en) | 2020-06-23 |
US10929103B2 (en) | 2021-02-23 |
EP3432137A1 (en) | 2019-01-23 |
ES2847287T3 (es) | 2021-08-02 |
US20190012147A1 (en) | 2019-01-10 |
TWI671645B (zh) | 2019-09-11 |
JP6793747B2 (ja) | 2020-12-02 |
US20210216285A1 (en) | 2021-07-15 |
JP2019512805A (ja) | 2019-05-16 |
TW201734836A (zh) | 2017-10-01 |
US20200319854A1 (en) | 2020-10-08 |
EP3751410A1 (en) | 2020-12-16 |
EP3432137A4 (en) | 2019-11-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017157197A1 (zh) | 随机数的生成及获取方法和装置 | |
US8539009B2 (en) | Parallel true random number generator architecture | |
EP1354444B1 (en) | Method for tracing traitor receivers in a broadcast encryption system | |
Arbitman et al. | Backyard cuckoo hashing: Constant worst-case operations with a succinct representation | |
US9529684B2 (en) | Method and system for hardware implementation of uniform random shuffling | |
US11876899B2 (en) | Random number generator and method of generating output random number | |
US10333708B1 (en) | Hybrid random-number generator | |
JP2018509833A (ja) | サイドチャネル解析抵抗アーキテクチャ | |
US9172537B1 (en) | Array encryption core | |
RU2749339C1 (ru) | Способ управления оборудованием, кластерная система, электронное устройство и читаемый носитель данных | |
JP2019512805A5 (zh) | ||
FR3078464A1 (fr) | Procede et circuit de mise en oeuvre d'une table de substitution | |
CN109254913A (zh) | 设备共享方法、装置、电子设备及计算机存储介质 | |
US9992053B1 (en) | Multi-channel, multi-lane encryption circuitry and methods | |
CN116488794A (zh) | 基于fpga的高速sm4密码模组实现方法及装置 | |
CN108872902B (zh) | 波形输出方法和装置 | |
US9519807B1 (en) | Hash generation circuitry and methods for multi-channel, multi-lane encryption and authentication | |
CN106034010B (zh) | 一种Serdes信号的传输特性参数筛选方法及装置 | |
US11347706B2 (en) | Rotor movement control and rotor wiring for rotor-based encryption machines and electronic equivalents | |
US9519597B2 (en) | Communication apparatus and method based on shared memory | |
JP2014222394A (ja) | 半導体記憶装置および乱数発生器 | |
CN103023594A (zh) | 获取扰码比特流的方法、同步比特扰码器及通信设备 | |
CN115296843B (zh) | 区块链系统中的交易执行方法、第一节点和第二节点 | |
WO2018120537A1 (zh) | 一种队列轮询选择方法及装置、计算机存储介质 | |
US20150160923A1 (en) | Random permutation generator and method for generating a random permutation sequence |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
ENP | Entry into the national phase |
Ref document number: 2018549163 Country of ref document: JP Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
WWE | Wipo information: entry into national phase |
Ref document number: 2017765739 Country of ref document: EP |
|
ENP | Entry into the national phase |
Ref document number: 2017765739 Country of ref document: EP Effective date: 20181017 |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17765739 Country of ref document: EP Kind code of ref document: A1 |