CN115878077A - True random number generation method and device, electronic equipment and readable storage medium - Google Patents

True random number generation method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115878077A
CN115878077A CN202211596798.1A CN202211596798A CN115878077A CN 115878077 A CN115878077 A CN 115878077A CN 202211596798 A CN202211596798 A CN 202211596798A CN 115878077 A CN115878077 A CN 115878077A
Authority
CN
China
Prior art keywords
random number
pseudo
sequence
generation
generating
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.)
Pending
Application number
CN202211596798.1A
Other languages
Chinese (zh)
Inventor
孟欣
廖嘉业
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN202211596798.1A priority Critical patent/CN115878077A/en
Publication of CN115878077A publication Critical patent/CN115878077A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The embodiment of the application provides a true random number generation method, a true random number generation device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: generating a pseudo-random number sequence using a pseudo-random number generation algorithm, the pseudo-random number sequence comprising a plurality of pseudo-random numbers; determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence; determining the offset of each pseudo-random number according to the generation delay time; and respectively generating a true random number according to each pseudo random number and the offset thereof. In this way, the generation time delay time of the pseudo random number sequence is used as the offset of each pseudo random number, and a plurality of true random numbers are obtained according to each pseudo random number and the offset thereof, so that a large number of true random numbers are generated in a short time, and the speed of generating the true random numbers is increased.

Description

True random number generation method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a true random number generation method and apparatus, an electronic device, and a readable storage medium.
Background
The random number generation algorithm commonly used at present has a linear congruence method, the random value generated by the linear congruence method belongs to a pseudo-random value, and the generated sequence is a periodic sequence. The random number generation algorithm in the prior art cannot generate a large number of true random numbers.
Disclosure of Invention
In order to solve the above technical problem, embodiments of the present application provide a true random number generation method, apparatus, electronic device, and readable storage medium.
In a first aspect, an embodiment of the present application provides a method for generating a true random number, where the method includes:
generating a pseudo-random number sequence using a pseudo-random number generation algorithm, the pseudo-random number sequence comprising a plurality of pseudo-random numbers;
determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence;
determining the offset of each pseudo random number according to the generation delay time;
and respectively generating a true random number according to each pseudo random number and the offset thereof.
In one embodiment, the determining the generation delay time of the pseudo random number sequence includes:
acquiring a CUP time stamp of the first pseudo random number and a CUP time stamp of the last pseudo random number;
and determining the time difference value of the CUP time stamp of the first pseudo-random number and the CUP time stamp of the last pseudo-random number as the generation delay time of the pseudo-random number sequence.
In one embodiment, the generating a true random number according to each pseudo random number and its offset includes:
and determining the sum of each pseudo random number and the offset thereof as a true random number.
In one embodiment, the generating a pseudo random number sequence using a pseudo random number generation algorithm includes:
and generating a current round pseudo-random number sequence by using the pseudo-random number generation algorithm according to a last round pseudo-random number sequence, a plurality of initial constant sequences and a last round generation delay time, wherein the last round pseudo-random number sequence comprises a plurality of pseudo-random numbers generated by the last round of the pseudo-random number generation algorithm, and each initial constant sequence comprises a plurality of initial constants.
In one embodiment, generating, by the pseudo random number generation algorithm, a current round pseudo random number sequence based on a round-over pseudo random number sequence, a plurality of initial constant sequences, and a round-over generation delay time, the round-over pseudo random number sequence comprising a plurality of pseudo random numbers generated by a round-over of the pseudo random number generation algorithm, each of the initial constant sequences comprising a plurality of initial constants, comprises:
determining a jth pseudo-random number of a current round pseudo-random number sequence according to the following formula;
aj=Aiai+Bi+TmodMi;
wherein, A i I-th initial constant, B, representing a first sequence of initial constants i I-th initial constant, M, representing a sequence of second initial constants i An ith initial constant representing a third sequence of initial constants, T representing a round-up generation delay time, a i I-th pseudo random number, a, representing the last round pseudo random number sequence j The jth pseudo random number representing the current round of pseudo random number sequence, mod represents the remainder operation, and j = i.
In one embodiment, the generating a pseudo-random number sequence using a pseudo-random number generation algorithm includes:
setting initial generation delay time, an initial random number sequence and a plurality of initial constant sequences;
and determining a first-round pseudo-random number sequence according to the initial generation delay time, the initial random number sequence and the initial constant sequences by utilizing the pseudo-random number generation algorithm.
In one embodiment, the generating a pseudo-random number sequence using a pseudo-random number generation algorithm includes:
and controlling the pseudo-random number generation algorithm to generate the pseudo-random number sequence through an AVX instruction set.
In a second aspect, an embodiment of the present application provides a true random number generation apparatus, where the apparatus includes:
a first generation module for generating a pseudo-random number sequence using a pseudo-random number generation algorithm, the pseudo-random number sequence comprising a plurality of pseudo-random numbers;
a first determining module, configured to determine a generation delay time of the pseudo random number sequence, where the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence;
the second determining module is used for determining the offset of each pseudo-random number according to the generation delay time;
and the second generation module is used for respectively generating a true random number according to each pseudo random number and the offset thereof.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor, where the memory is used to store a computer program, and the computer program executes the true random number generation method provided in the first aspect when the processor runs.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, where the computer program, when executed on a processor, performs the method for generating true random numbers provided in the first aspect.
The method, the device, the electronic device and the readable storage medium for generating the true random number utilize a pseudo-random number generation algorithm to generate a pseudo-random number sequence, wherein the pseudo-random number sequence comprises a plurality of pseudo-random numbers; determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence; determining the offset of each pseudo random number according to the generation delay time; and respectively generating a true random number according to each pseudo random number and the offset thereof. In this way, the generation time delay time of the pseudo random number sequence is used as the offset of each pseudo random number, and a plurality of true random numbers are obtained from each pseudo random number and the offset thereof, so that a large number of true random numbers are generated in a short time, and the speed of generating the true random numbers is increased.
Drawings
To more clearly illustrate the technical solutions of the present application, the drawings required for use in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope of the present application. Like components are numbered similarly in the various figures.
FIG. 1 is a flow chart of a true random number generation method provided by an embodiment of the present application;
fig. 2 shows a schematic structural diagram of a true random number generation apparatus provided in an embodiment of the present application.
An icon: 200-true random number generating means; 201-a first generation module; 202-a first determination module; 203-a second determination module; 204-a second generation module.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
The components of the embodiments of the present application, as generally described and illustrated in the figures herein, could be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as presented in the figures, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present application, are intended to indicate only specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another, and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the present application belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments.
The currently commonly used random number generation algorithm has a linear congruence method, which generates pseudo random numbers according to the following formula:
a n+1 =A×a n +BmodM;
recursively generating a series of sequences as random values, a, from the above formula n+1 Denotes the n +1 th random value, a n Representing the nth random value, a, B and M are 3 initial constants, if a, B and M are known, and the currently generated random value is known, the next random value can be easily calculated. The random values generated by the linear congruence method belong to pseudo-random values. It can also be seen from the above formula that the resulting sequence is a periodic sequence with a maximum period of M. The random number generation algorithm in the prior art cannot generate a large number of true random numbers.
Example 1
The embodiment of the application provides a true random number generation method.
Referring to fig. 1, the method for generating a true random number according to the embodiment of the present application includes steps S101 to S104, which are described below.
Step S101, a pseudo-random number sequence is generated by using a pseudo-random number generation algorithm, and the pseudo-random number sequence comprises a plurality of pseudo-random numbers.
In one embodiment, step S101 includes:
and generating a current round pseudo-random number sequence by using the pseudo-random number generation algorithm according to a round pseudo-random number sequence, a plurality of initial constant sequences and a round generation delay time, wherein the round pseudo-random number sequence comprises a plurality of pseudo-random numbers generated by the pseudo-random number generation algorithm in a round, and each initial constant sequence comprises a plurality of initial constants.
The plurality of initial constant sequences may be 2, 3, N initial constant sequences, where N is a positive integer determined according to actual conditions, and is not limited herein.
In this embodiment, in order to improve the randomness of the pseudo random number sequence as much as possible, multiple rounds of operations may be performed by using a pseudo random number generation algorithm, each round of operations obtains a corresponding pseudo random number sequence, and subsequent calculations may be performed by using a pseudo random number sequence with better randomness. The current round pseudo-random number sequence is obtained based on the last round pseudo-random number sequence, a plurality of initial constant sequences and a plurality of generation delay times of the last round.
In one embodiment, the pseudo random number generation algorithm is utilized to generate a current round pseudo random number sequence according to a round-up pseudo random number sequence, a plurality of initial constant sequences and a round-up generation delay time, wherein the round-up pseudo random number sequence comprises a plurality of pseudo random numbers generated by the round-up pseudo random number generation algorithm, and each initial constant sequence comprises a plurality of initial constants, and the method comprises the following steps:
determining a jth pseudo-random number of a current round pseudo-random number sequence according to the following formula;
aj=Aiai+Bi+TmodMi;
wherein, A i I-th initial constant, B, representing a first sequence of initial constants i I-th initial constant, M, representing a sequence of second initial constants i An ith initial constant representing a third sequence of initial constants, T represents a round generation delay time, a i I-th pseudo random number representing the last round pseudo random number sequence, a j The jth pseudo random number representing the current round of pseudo random number sequence, mod represents the remainder operation, and j = i.
Exemplarily, the first initial constant sequence, the second initial constant sequence and the third initial constant sequence may be represented by the following matrices:
Figure BDA0003993326180000071
wherein, A 1 To A N Represents the first initialThe constant sequence includes N initial constants, B 1 To B N Indicating that the second initial constant sequence includes N initial constants, M 1 To M N It is shown that the third initial constant sequence comprises N initial constants and, correspondingly, N pseudo random numbers can be calculated. For example, N may be 4096, or may be other setting values, which are not limited herein.
In one embodiment, step S101 includes:
setting initial generation delay time, an initial random number sequence and a plurality of initial constant sequences;
and determining a first-round pseudo-random number sequence according to the initial generation delay time, the initial random number sequence and the initial constant sequences by utilizing the pseudo-random number generation algorithm.
For example, the initial generation delay time may be set to 0, and a plurality of pseudo random numbers may be randomly acquired to form an initial random number sequence, where the plurality of initial constant sequences are a first initial constant sequence, a second initial constant sequence, a third initial constant sequence, and a first initial constant sequence, a second initial constant sequence, and a third initial constant sequence that are preset. For example, A 1 To A N Representing a first initial constant sequence, B 1 To B N Representing a second initial constant sequence, M 1 To M N Representing a third initial constant sequence, and determining a jth pseudo-random number of the first round pseudo-random number sequence by using the following formula;
a j =A i a i +B i +TmodM i
A i i-th initial constant, B, representing a first sequence of initial constants i I-th initial constant, M, representing a second sequence of initial constants i An ith initial constant representing a third sequence of initial constants, T being 0 i I-th pseudo random number representing an initial random number sequence, a j The jth pseudo-random number representing the current round of pseudo-random number sequence, mod represents the remainder operation, and j = i,1 ≦ i ≦ N,1 ≦ j ≦ N. For example, N may be 4096, or may be other setting values, which are not limited herein.
In one embodiment, step S101 includes:
controlling the pseudo-random number generation algorithm to generate the pseudo-random number sequence through an AVX instruction set.
In this embodiment, the Advanced Vector Extensions (AVX) Instruction set is one of Single Instruction stream Multiple Data (SIMD), and 8 pseudo-random numbers can be updated by a Single Instruction using a Single AVX Instruction set with 8 instructions as a group, so that the number of cycles is reduced, thereby achieving acceleration. Thus, the calculation of the single instruction stream and the multiple data streams can be realized, so that a large number of pseudo random numbers can be generated in a short time, the time of the pseudo random numbers is prolonged, and the time for generating a large number of true random numbers is effectively shortened.
Step S102, determining the generation delay time of the pseudo random number sequence, wherein the generation delay time is the time required from the first pseudo random number to the last pseudo random number of the pseudo random number sequence.
In this embodiment, after a round of operation is performed by using a pseudo random number generation algorithm, a pseudo random number sequence may be generated, where the pseudo random number sequence corresponding to each round includes a plurality of pseudo random numbers, and since a calculation Processing speed of a Central Processing Unit (CPU) is unpredictable, a generation time of the pseudo random number sequence is truly random. The delay time for the generation of each pseudo-random number sequence is unpredictable, i.e. truly random, each time a pseudo-random number sequence is generated. That is, the generation delay time of each pseudo random number sequence is unpredictable and truly random. The CPU time stamp of each round of the pseudo-random number sequence can be used to determine its generation delay time.
In one embodiment, step S102 includes:
acquiring a CUP time stamp of the first pseudo random number and a CUP time stamp of the last pseudo random number;
and determining the time difference value of the CUP time stamp of the first pseudo random number and the CUP time stamp of the last pseudo random number as the generation delay time of the pseudo random number sequence.
For example, if pseudo-randomThe number sequence comprises N pseudo random numbers, the CPU time stamp of the 1 st pseudo random number being T 1 The CPU time stamp of the 1 st pseudo random number is T N Then the generation delay time of the pseudo random number sequence = nth pseudo random number CPU time stamp T N 11 th pseudo-random number CPU time stamp T 1 . Thus, each time a pseudo random number is generated, a high-precision generation delay time is acquired by using the CPU time stamp.
Step S103, determining the offset of each pseudo random number according to the generation delay time.
In this embodiment, since the generation delay time of the pseudo random number sequence is unpredictable, that is, the generation delay time of the pseudo random number sequence is truly random, the offset of each pseudo random number is determined according to the generation delay time of the pseudo random number sequence, and it is ensured that the truly random number can be obtained subsequently. Illustratively, the generation delay time of the pseudo random number sequence may be used as the offset of each pseudo random number. The shift amount of each pseudo random number can be obtained by performing operations such as addition, subtraction, multiplication, and division based on the generation delay time of the pseudo random number sequence.
And step S104, respectively generating a true random number according to each pseudo random number and the offset thereof.
In one embodiment, step S104 includes:
and determining the sum of each pseudo random number and the offset value thereof as the true random number.
In this way, the speed of generating random numbers is increased, and true random numbers are generated.
The following describes the calculation of each round of pseudo random number sequences according to the formula aj = Aiai + Bi + TmodMi.
First, a first initial constant sequence A is initialized i A second initial constant sequence B i A third initial constant sequence M i Setting the initial generation delay time to 0, and initializing the initial pseudo-random number sequence a i And i is more than or equal to 1 and less than or equal to N, judging whether all the pseudo random numbers of each round of pseudo random number sequences are generated, and if so, outputting each round of pseudo random number sequences. If not, recording the current CPU time stamp T 0 . According to the formula ajThe i-th pseudo random number of each round of pseudo random number sequence is calculated by = Aiai + Bi + TmodMi, and the meaning of each letter of the formula refers to the description of other parts of this embodiment, which is not described herein again. Judging whether i is less than or equal to N, if so, assigning the value of i +1 to i, calculating the next pseudo-random number according to the formula, and if i is more than N, recording the current CPU time stamp T 1 Outputting or recording the current N pseudo-random numbers a i Calculating CPU time stamp T 1 And CPU time stamp T 0 The time difference value is used as the delay time generated by the upper round used when the pseudo-random number sequence is calculated by the lower round.
In the method for generating a true random number provided by this embodiment, a pseudo random number sequence is generated by using a pseudo random number generation algorithm, where the pseudo random number sequence includes a plurality of pseudo random numbers; determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence; determining the offset of each pseudo-random number according to the generation delay time; and respectively generating a true random number according to each pseudo random number and the offset thereof. In this way, the generation time delay time of the pseudo random number sequence is used as the offset of each pseudo random number, and a plurality of true random numbers are obtained from each pseudo random number and the offset thereof, so that a large number of true random numbers are generated in a short time, and the speed of generating the true random numbers is increased.
Example 2
In addition, the embodiment of the application provides a true random number generation device.
As shown in fig. 2, the true random number generation apparatus 200 includes:
a first generation module 201 for generating a pseudo random number sequence using a pseudo random number generation algorithm, the pseudo random number sequence comprising a plurality of pseudo random numbers;
a first determining module 202, configured to determine a generation delay time of the pseudo random number sequence, where the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence;
a second determining module 203, configured to determine an offset of each pseudo random number according to the generation delay time;
and a second generating module 204, configured to generate a true random number according to each pseudo random number and its offset.
In an embodiment, the first determining module 202 is further configured to obtain a CUP timestamp of the first pseudo random number and a CUP timestamp of the last pseudo random number;
and determining the time difference value of the CUP time stamp of the first pseudo-random number and the CUP time stamp of the last pseudo-random number as the generation delay time of the pseudo-random number sequence.
In one embodiment, the second generating module 204 is further configured to determine a sum of each of the pseudo random numbers and the offset thereof as one of the true random numbers.
In one embodiment, the first generating module 201 is further configured to generate a current round pseudo random number sequence according to a round pseudo random number sequence, a plurality of initial constant sequences and a round generation delay time by using the pseudo random number generation algorithm, where the round pseudo random number sequence includes a plurality of pseudo random numbers generated by a round generation of the pseudo random number generation algorithm, and each of the initial constant sequences includes a plurality of initial constants.
In one embodiment, the first generation module 201 is further configured to determine a jth pseudo random number of the current round of pseudo random number sequence according to the following formula;
aj=Aiai+Bi+TmodMi;
wherein, A i I-th initial constant, B, representing a first sequence of initial constants i I-th initial constant, M, representing a sequence of second initial constants i An ith initial constant representing a third sequence of initial constants, T representing a round-up generation delay time, a i I-th pseudo random number representing the last round pseudo random number sequence, a j The jth pseudo random number representing the current round of pseudo random number sequence, mod represents the remainder operation, and j = i.
In one embodiment, the first generating module 201 is further configured to set an initial generation delay time, an initial random number sequence, and a plurality of initial constant sequences;
and determining a first-round pseudo-random number sequence according to the initial generation delay time, the initial random number sequence and the initial constant sequences by utilizing the pseudo-random number generation algorithm.
In one embodiment, the first generating module 201 is further configured to control the pseudo random number generation algorithm to generate the pseudo random number sequence through an AVX instruction set.
The true random number generating device 200 provided in this embodiment can implement the true random number generating method provided in embodiment 1, and is not described herein again to avoid repetition.
The true random number generating device provided by this embodiment generates a pseudo random number sequence by using a pseudo random number generation algorithm, where the pseudo random number sequence includes a plurality of pseudo random numbers; determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence; determining the offset of each pseudo random number according to the generation delay time; and respectively generating a true random number according to each pseudo random number and the offset thereof. In this way, the generation time delay time of the pseudo random number sequence is used as the offset of each pseudo random number, and a plurality of true random numbers are obtained from each pseudo random number and the offset thereof, so that a large number of true random numbers are generated in a short time, and the speed of generating the true random numbers is increased.
Example 3
Furthermore, an electronic device is provided in an embodiment of the present application, and includes a memory and a processor, where the memory stores a computer program, and the computer program executes the true random number generation method provided in embodiment 1 when running on the processor.
The electronic device provided in this embodiment may implement the method for generating a true random number provided in embodiment 1, and in order to avoid repetition, details are not described here.
Example 4
The present application further provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the true random number generation method provided in embodiment 1.
In this embodiment, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The computer-readable storage medium provided in this embodiment may implement the method for generating a true random number provided in embodiment 1, and is not described herein again to avoid repetition.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of additional like elements in the process, method, article, or terminal that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application or portions thereof that contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the present embodiments are not limited to those precise embodiments, which are intended to be illustrative rather than restrictive, and that various changes and modifications may be effected therein by one skilled in the art without departing from the scope of the appended claims.

Claims (10)

1. A method of generating true random numbers, the method comprising:
generating a pseudo-random number sequence using a pseudo-random number generation algorithm, the pseudo-random number sequence comprising a plurality of pseudo-random numbers;
determining a generation delay time of the pseudo random number sequence, wherein the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence;
determining the offset of each pseudo-random number according to the generation delay time;
and respectively generating a true random number according to each pseudo random number and the offset thereof.
2. The method of claim 1, wherein said determining a generation delay time of said pseudo-random number sequence comprises:
acquiring a CUP time stamp of the first pseudo random number and a CUP time stamp of the last pseudo random number;
and determining the time difference value of the CUP time stamp of the first pseudo random number and the CUP time stamp of the last pseudo random number as the generation delay time of the pseudo random number sequence.
3. The method of claim 1, wherein generating a true random number based on each of the pseudo random numbers and the offsets thereof, respectively, comprises:
and determining the sum of each pseudo random number and the offset value thereof as the true random number.
4. The method of claim 1, wherein generating the sequence of pseudo-random numbers using a pseudo-random number generation algorithm comprises:
and generating a current round pseudo-random number sequence by using the pseudo-random number generation algorithm according to a round pseudo-random number sequence, a plurality of initial constant sequences and a round generation delay time, wherein the round pseudo-random number sequence comprises a plurality of pseudo-random numbers generated by the pseudo-random number generation algorithm in a round, and each initial constant sequence comprises a plurality of initial constants.
5. The method of claim 4, wherein generating a current round pseudo random number sequence using the pseudo random number generation algorithm based on a last round pseudo random number sequence comprising a plurality of pseudo random numbers generated by a last round of the pseudo random number generation algorithm, a plurality of initial constant sequences, and a last round generation delay time, each of the initial constant sequences comprising a plurality of initial constants comprises:
determining a jth pseudo-random number of a current round pseudo-random number sequence according to the following formula;
aj=Aiai+Bi+TmodMi;
wherein A is i I-th initial constant, B, representing a first sequence of initial constants i I-th initial constant, M, representing a second sequence of initial constants i An ith initial constant representing a third sequence of initial constants, T representing a round-up generation delay time, a i I-th pseudo random number representing the last round pseudo random number sequence, a j The jth pseudo random number representing the current round of pseudo random number sequence, mod represents the remainder operation, and j = i.
6. The method of claim 4, wherein generating the sequence of pseudo-random numbers using a pseudo-random number generation algorithm comprises:
setting initial generation delay time, an initial random number sequence and a plurality of initial constant sequences;
and determining a first-round pseudo-random number sequence according to the initial generation delay time, the initial random number sequence and the initial constant sequences by utilizing the pseudo-random number generation algorithm.
7. The method of claim 1, wherein generating the sequence of pseudo-random numbers using a pseudo-random number generation algorithm comprises:
and controlling the pseudo-random number generation algorithm to generate the pseudo-random number sequence through an AVX instruction set.
8. An apparatus for generating true random numbers, the apparatus comprising:
a first generation module for generating a pseudo random number sequence using a pseudo random number generation algorithm, the pseudo random number sequence comprising a plurality of pseudo random numbers;
a first determining module, configured to determine a generation delay time of the pseudo random number sequence, where the generation delay time is a time required for generating a first pseudo random number to a last pseudo random number of the pseudo random number sequence;
a second determining module, configured to determine an offset of each pseudo random number according to the generation delay time;
and the second generation module is used for respectively generating a true random number according to each pseudo random number and the offset thereof.
9. An electronic device, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, performs the true random number generation method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when run on a processor, performs the true random number generation method of any one of claims 1 to 7.
CN202211596798.1A 2022-12-12 2022-12-12 True random number generation method and device, electronic equipment and readable storage medium Pending CN115878077A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211596798.1A CN115878077A (en) 2022-12-12 2022-12-12 True random number generation method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211596798.1A CN115878077A (en) 2022-12-12 2022-12-12 True random number generation method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115878077A true CN115878077A (en) 2023-03-31

Family

ID=85767214

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211596798.1A Pending CN115878077A (en) 2022-12-12 2022-12-12 True random number generation method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115878077A (en)

Similar Documents

Publication Publication Date Title
US8145692B2 (en) Digital generation of an accelerated or decelerated chaotic numerical sequence
CN109634819B (en) Alarm root cause positioning method and device and electronic equipment
CN110390075B (en) Matrix preprocessing method, device, terminal and readable storage medium
US5793657A (en) Random number generating apparatus and random number generating method in a multiprocessor system
WO2018094299A2 (en) System architecture and method of processing data therein
US20090150467A1 (en) Method of generating pseudo-random numbers
CN107480771B (en) Deep learning-based activation function realization method and device
CN114138231B (en) Method, circuit and SOC for executing matrix multiplication operation
JP4452722B2 (en) Method and apparatus for generating a delay using a counter
CN111209111A (en) Resource allocation method, device, equipment and storage medium based on block chain system
CN110851987A (en) Method, apparatus and storage medium for predicting calculated duration based on acceleration ratio
CN116962438B (en) Gradient data synchronization method, system, electronic equipment and readable storage medium
CN115878077A (en) True random number generation method and device, electronic equipment and readable storage medium
WO2018135515A1 (en) Information processing device, neural network design method, and recording medium
US8185900B2 (en) Method for the real-time capability analysis of a system by selectively using approximated or actual system expenses for jobs
CN111880942A (en) Network threat processing method and device
Alam et al. GPU-based parallel algorithm for generating massive scale-free networks using the preferential attachment model
EP2442225A2 (en) Modulo operation method and apparatus for same
CN111260056A (en) Network model distillation method and device
US20140286488A1 (en) Determining a Division Remainder and Ascertaining Prime Number Candidates for a Cryptographic Application
CN114063981A (en) Method for acquiring high-quality pseudo random number
CN110895479B (en) Data processing method, device and equipment
CN108062545B (en) Face alignment method and device
CN111506382A (en) Progress bar curve determination method and device, storage medium and electronic equipment
CN115659380B (en) Ciphertext data fitting calculation method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination