CN110543292A - random number sequence generation method - Google Patents

random number sequence generation method Download PDF

Info

Publication number
CN110543292A
CN110543292A CN201910682069.XA CN201910682069A CN110543292A CN 110543292 A CN110543292 A CN 110543292A CN 201910682069 A CN201910682069 A CN 201910682069A CN 110543292 A CN110543292 A CN 110543292A
Authority
CN
China
Prior art keywords
sequence
sample
random number
round
dimensional
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
CN201910682069.XA
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.)
Guodian Nanjing Automation Co Ltd
Original Assignee
Guodian Nanjing Automation 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 Guodian Nanjing Automation Co Ltd filed Critical Guodian Nanjing Automation Co Ltd
Priority to CN201910682069.XA priority Critical patent/CN110543292A/en
Publication of CN110543292A publication Critical patent/CN110543292A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Analogue/Digital Conversion (AREA)

Abstract

The invention discloses a random number sequence generation method, which comprises the steps of amplifying a one-dimensional sample space to a multi-dimensional sample space, and arranging the amplified sample spaces in sequence; carrying out disorder operation on the sample spaces which are sequentially arranged after amplification, and disturbing the sample spaces; sequentially collecting sample elements from the disordered sample space, and simultaneously continuing disorder operation until the total length of the collected sample elements is more than or equal to the total length of the target sequence; and deleting the sequence part with the length exceeding the total length of the target sequence, wherein the residual sample sequence with the length equal to the total length of the target sequence is the target random number sequence. The method is used for amplifying the one-dimensional sample space, the sample space is uniformly distributed in the 1-dimensional-T-dimensional hyperplane, and the defect of a sparse grid structure in a high-dimensional space existing in a linear congruence method can be avoided; the size of the sample space after expansion is far larger than the total number of samples, and the influence of long period correlation caused by the linear congruence method can be eliminated to the maximum extent.

Description

random number sequence generation method
Technical Field
the invention relates to a random number sequence generation method, and belongs to the technical field of data processing.
Background
in general, the classical generators capable of generating uniformly distributed random number sequences are mainly Linear Congruence Generators (LCG), feedback shift register generators (LFSR, metson rotation algorithm). The common drawbacks of these methods are long period correlation and high dimensional non-uniformity. Linear congruence methods have long period correlations limited by the modulus M. Under high dimension, the linear congruence method can form a sparse grid structure, and the feedback shift register method can form a butterfly-shaped sparse grid structure.
to overcome the drawbacks of the above methods, many new methods of random number sequence generation have emerged in recent years. For example, non-linear congruence methods, particularly the inverse congruence method thereof; a carry-plus/borrow-minus/carry-multiply (AWC/SWB/MWC) generator; as well as complex prime generators and various combinatorial generators in which multipliers and increments also vary in recursion. However, the drawback of generating high-dimensional sparse grid structures is not fundamentally improved except for the inverse congruence method; the inverse congruence method does not change the long period related defects.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides a random number sequence generation method which can solve the technical problems of long period correlation and high dimensional non-uniformity of each random sequence generation method in the prior art.
In order to solve the technical problems, the invention is realized by adopting the following technical scheme: a method of random number sequence generation, the method comprising the steps of:
Amplifying the one-dimensional sample space to a multi-dimensional sample space, and sequentially arranging the amplified sample spaces;
Carrying out disorder operation on the sample spaces which are sequentially arranged after amplification, and disturbing the sample spaces;
Sequentially collecting sample elements from the disordered sample space, and simultaneously continuing disorder operation until the total length of the collected sample elements is more than or equal to the total length of the target sequence;
and deleting the sequence part with the length exceeding the total length of the target sequence, wherein the residual sample sequence with the length equal to the total length of the target sequence is the target random number sequence.
Furthermore, a one-dimensional sample space is amplified by adopting a multi-element arrangement mode.
Further, the method of out-of-order operation includes the steps of:
taking the termination sequence of the previous round of out-of-order operation as the initial sequence of the round of out-of-order operation, and taking the sample sequence which is sequentially arranged after amplification as the initial sequence for the first round of out-of-order operation;
traversing the initial sequence by using a linear congruence generator in a random walk mode, and randomly generating a new sample sequence as a termination sequence;
and (5) sequentially iterating according to the steps until the preset iteration times are reached, and finishing out-of-order operation.
further, multipliers and increments of linear congruential generators adopted by each round of out-of-order operation are different.
Further, for each round of out-of-order operation, a data structure of a single-direction linked list is adopted to store an initial sequence and a termination sequence.
further, each round of random walk operation is realized by an agent, and the agent starts the random walk operation from any position corresponding to the initial sequence.
Further, the method for traversing the initial sequence by using the random walk mode comprises the following steps:
For each round of random walk operation, when a random number Rj is generated, the corresponding agent moves forward along the one-way linked list to Rj step and reaches a new position POSj;
Deleting the sample elements corresponding to the new position POSj from the one-way linked list, and moving the sample elements to the one-way linked list of the termination sequence;
And starting the random walk operation of the next time by the agent from the position of POSj +1 until the one-way linked list of the current initial sequence is emptied and is filled with the one-way linked list of the termination sequence, and finishing one round of random walk operation.
Further, the method for sequentially collecting the sample elements comprises the following steps:
and for the one-way linked list of the sample sequence in the previous round of disorder, removing the first sample element in the one-way linked list each time and adding the first sample element into the sampling list.
Further, the method of continuous out-of-order operation includes the steps of:
And randomly exchanging the second sample element to the kth sample element in the unidirectional chain table with a certain sample element in the residual sample space, wherein k is larger than 3.
further, the method further comprises the step of normalizing the target random number sequence when the target random number sequence is required to be uniformly distributed in U (0, 1).
compared with the prior art, the invention has the following beneficial effects:
the one-dimensional sample space is amplified, and the sample space is uniformly distributed in a 1-dimensional-T-dimensional hyperplane, so that the defect of a sparse grid structure in a high-dimensional space existing in a linear congruence method can be avoided;
the size of the sample space after expansion is far larger than the total number of samples, and the influence of long period correlation caused by the linear congruence method can be eliminated to the maximum extent;
The random walk of multiple sampling rounds breaks up the sample space, and the operation of the sample space is continuously disordered during sampling, so that the randomness of the random number sequence is enhanced.
Drawings
Fig. 1 is a flowchart of a method for generating a random number sequence according to an embodiment of the present invention.
Detailed Description
The method for generating the random number sequence provided by the embodiment of the invention mainly expands a sample space, namely, a one-dimensional sample space is expanded to a multi-dimensional (multidimensional) sample space in a multi-element arrangement mode, and the expanded sample space is uniformly distributed in a 1-dimensional-T-dimensional hyperplane; disordering the sample sequence in the sample space by a multi-round linear congruence method; and the out-of-order operation is continuously carried out while the sequential sampling is carried out, so that the randomness of the sample sequence can be increased.
the invention is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
as shown in fig. 1, a method for generating a random number sequence according to an embodiment of the present invention mainly includes the following steps:
The method comprises the following steps: expanding the sample space:
Assuming that the one-dimensional sample space is (0, 1, 2, 3, … …, M), all 1-to T-member subsequences are included in the sample space, and the amplified sample space size K is calculated:
Taking T0-M original sample sequences in succession as T-element subsequences, wherein T is more than 2 and less than M; the extended sample space comprises 1-element subsequences, 2-element subsequences, … … and T-element subsequences. By adopting the mode of extending the subsequence from 1 element to T element, the sample space is ensured to be uniformly distributed on the basis of multiple elements (multiple dimensions), and the defect of a sparse grid structure in a high-dimensional space existing in a linear congruence method can be avoided.
The 1-membered subsequence, the 2-membered subsequence, … …, and the T-membered subsequence contained in the amplified sample space are ordered in the order of magnitude of 1-membered order, 2-membered order, … …, and T-membered order, and are referred to as "augmented initial sample sequence".
the sequence length of all subsequences added together is L (where T is the length of a T-element subsequence T, T is 1, 2, … …, T), and the value of L is also determined by the values of M and T, and can be written as L (M, T)
assuming that the total length of the random number target sequence to be generated is N, the size of the element number T is selected according to the following relation, and L (M, T) is more than or equal to 2 xN.
the embodiment of the invention adopts the subsequence to replace the original sample element of the 0-M sample space, and the sample element is changed from a single number to a number array (namely the subsequence) in a multi-element arrangement, thereby greatly enlarging the range of the sample space and eliminating the influence of long period correlation caused by using a linear congruence method to the maximum extent.
Step two: disturbing the sample space:
The expanded sample space is ordered sequentially according to the combined number size of the subsequences. And (4) carrying out a round of disorder operation on the expanded sample space. Each round of shuffling operation is to use the sample sequence SEQi (i ═ 0, 1, 2, … …, a-2) generated in the previous round as the initial sequence of the round of shuffling operation, and use a Linear Congruence Generator (LCG) to traverse the sample sequence in the previous round by using a Random Walk (Random Walk) mode, so as to randomly generate a new sample sequence SEQi +1(i ═ 1, 2, … …, a-1), which is called a termination sequence.
The sample sequence SEQI +1 generated in the (i + 1) th round has the same sample space size and is still K, but the sequence is changed. And (3) performing the i +2 round of out-of-order operation, taking SEQI +1 as an initial sequence of the i +2 round of operation, generating a new termination sequence SEQI +2, sequentially performing a round of iteration, and finally generating a SEQI sample sequence for the next sampling operation. It should be noted that the Linear Congruence Generator (LCG) used for each round of out-of-order operation has different multipliers and increments.
In each round of out-of-order operation, no matter the sequence is an initial sequence or a termination sequence, the sample sequence is stored in a form of a single linked list, and Random Walk (Random Walk) operation is facilitated. Each round of random walk operation is implemented by an Agent (Agent) that starts the random walk from any position POS0 in the initial sequence.
and each time a random number Rj is generated, the agent moves forward Rj along the one-way linked list to reach a new position POSj, an element Ej (the element Ej represents a subsequence in the sample space after expansion) at the position is deleted from the one-way linked list of the initial sequence and moved to the linked list of the termination sequence, the agent automatically points to the position of an element POSj +1 next to the initial sequence, and the next random walk operation is started. And completing a round of random walk operation until the singly-linked list of the initial sequence is emptied and the termination sequence is filled.
The termination sequence is used as the initial sequence of the next round of out-of-order operation until the a round of out-of-order operation is completed, and the step of disordering the sample space is also completed.
Step three: and (3) sequential sampling:
Taking out the first sample element SMPi (i is 1, 2, … …, p, representing the 1 st sample element to the p th sample element) of the one-way linked list each time, removing the one-way linked list of the disturbed sample sequence completed in the last step, and adding the sample element SMPi into the sampling list. The length len of the sample element SMPi is the length of the subsequence and is denoted len (SMPi).
meanwhile, the continuous disorder sample operation is carried out on the 2 nd sample element to the k th sample element (generally k >3) in the unidirectional chain table. These k-1 sample elements are randomly swapped with some sample element in the remaining sample space. Thus, the following elements, except the first k samples, are again randomly swapped k-1 times before being sampled. The uniformly distributed characteristic is also kept while the disordered samples are continuously carried out.
Step four: and (3) ending the sequence:
In the sampling process, when the pth sample element is collected, the total sampling LENGTH is the sum of the LENGTHs of each collected sample element, that is:
LENGTH=len(SMP)+len(SMP)+len(SMP)+……+len(SMP)
wherein, SMPp represents the p sample element; len (smpp) represents the length of the p-th sample element.
the sampling may be terminated when the total LENGTH of samples LENGTH is equal to or greater than the total LENGTH of target sequences N. Then, the redundant sequence is partially deleted, and the remaining sequence with the total length of N is the target sequence. If the target sequence is required to be uniformly distributed in U (0, 1), corresponding normalization processing is carried out.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for generating a sequence of random numbers, the method comprising the steps of:
Amplifying the one-dimensional sample space to a multi-dimensional sample space, and sequentially arranging the amplified sample spaces;
Carrying out disorder operation on the sample spaces which are sequentially arranged after amplification, and disturbing the sample spaces;
Sequentially collecting sample elements from the disordered sample space, and simultaneously continuing disorder operation until the total length of the collected sample elements is more than or equal to the total length of the target sequence;
And deleting the sequence part with the length exceeding the total length of the target sequence, wherein the residual sample sequence with the length equal to the total length of the target sequence is the target random number sequence.
2. The method of claim 1, wherein the one-dimensional sample space is amplified by a multivariate arrangement.
3. The random number sequence generation method of claim 1, wherein the method of out-of-order operation comprises the steps of:
Taking the termination sequence of the previous round of out-of-order operation as the initial sequence of the round of out-of-order operation, and taking the sample sequence which is sequentially arranged after amplification as the initial sequence for the first round of out-of-order operation;
traversing the initial sequence by using a linear congruence generator in a random walk mode, and randomly generating a new sample sequence as a termination sequence;
And (5) sequentially iterating according to the steps until the preset iteration times are reached, and finishing out-of-order operation.
4. The method of claim 3, wherein multipliers and increments of the linear congruential generators used in each round of out-of-order operation are different.
5. the method of claim 3, wherein the initial sequence and the termination sequence are stored using a data structure of a singly linked list for each round of out-of-order operation.
6. the method of claim 5, wherein each round of the random walk operation is performed by an agent that initiates the random walk operation from any position corresponding to the initial sequence.
7. The random number sequence generation method of claim 6, wherein the method of traversing the initial sequence in a random walk manner comprises the steps of:
for each round of random walk operation, when a random number Rj is generated, the corresponding agent moves forward along the one-way linked list to Rj step and reaches a new position POSj;
deleting the sample elements corresponding to the new position POSj from the one-way linked list, and moving the sample elements to the one-way linked list of the termination sequence;
And starting the random walk operation of the next time by the agent from the position of POSj +1 until the one-way linked list of the current initial sequence is emptied and is filled with the one-way linked list of the termination sequence, and finishing one round of random walk operation.
8. the method of generating random number sequence of claim 5, wherein the method of sequentially collecting sample elements comprises:
and for the one-way linked list of the sample sequence in the previous round of disorder, removing the first sample element in the one-way linked list each time and adding the first sample element into the sampling list.
9. the method of random number sequence generation of claim 8, wherein said method of continuing out-of-order operation comprises the steps of:
And randomly exchanging the second sample element to the kth sample element in the unidirectional chain table with a certain sample element in the residual sample space, wherein k is larger than 3.
10. The random number sequence generation method according to claim 1, further comprising normalizing the target random number sequence when it is required that the target random number sequence is uniformly distributed in U (0, 1).
CN201910682069.XA 2019-07-26 2019-07-26 random number sequence generation method Pending CN110543292A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910682069.XA CN110543292A (en) 2019-07-26 2019-07-26 random number sequence generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910682069.XA CN110543292A (en) 2019-07-26 2019-07-26 random number sequence generation method

Publications (1)

Publication Number Publication Date
CN110543292A true CN110543292A (en) 2019-12-06

Family

ID=68710353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910682069.XA Pending CN110543292A (en) 2019-07-26 2019-07-26 random number sequence generation method

Country Status (1)

Country Link
CN (1) CN110543292A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485676A (en) * 2021-07-08 2021-10-08 上海通联金融服务有限公司 Method and system for randomly generating credit card number
CN114143284A (en) * 2021-11-25 2022-03-04 奇安信科技集团股份有限公司 Data identifier generation method and device, electronic equipment and storage medium
CN114143284B (en) * 2021-11-25 2024-06-21 奇安信科技集团股份有限公司 Data identifier generation method and device, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104380651A (en) * 2012-05-24 2015-02-25 埃尼格传媒公司 Method for generating pseudorandom sequence, and method for coding or decoding data stream

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104380651A (en) * 2012-05-24 2015-02-25 埃尼格传媒公司 Method for generating pseudorandom sequence, and method for coding or decoding data stream

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485676A (en) * 2021-07-08 2021-10-08 上海通联金融服务有限公司 Method and system for randomly generating credit card number
CN114143284A (en) * 2021-11-25 2022-03-04 奇安信科技集团股份有限公司 Data identifier generation method and device, electronic equipment and storage medium
CN114143284B (en) * 2021-11-25 2024-06-21 奇安信科技集团股份有限公司 Data identifier generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11797865B2 (en) System and method for performing fast computations using quantum counting and pseudo-random sets
JP2012169979A5 (en)
US7917835B2 (en) Memory system and method for use in trellis-based decoding
CN102184205B (en) Based on the Multi-Pattern Matching method of easily extensible precision chaos Hash
CN104142969B (en) The treating method and apparatus of deblocking
CN110543292A (en) random number sequence generation method
Jiang et al. Exposing and exploiting fine-grained block structures for fast and accurate sparse training
WO2021138719A1 (en) Systems and computer-implemented methods for generating pseudo random numbers
CN110362606B (en) Time series variable-length die body mining method
Fahn Maxwell's Demon and the entropy cost of information
Breslauer et al. Simple real-time constant-space string matching
Lin et al. On the fundamental limit of private information retrieval for coded distributed storage
KR101222486B1 (en) Method, server, terminal, and computer-readable recording medium for selectively eliminating nondeterministic element of nondeterministic finite automata
US11049034B2 (en) System and method for performing fast computations using quantum counting based on simultaneous solutions to decision problem and associated hashing problem
Sharipov et al. Compressive sparse binary signals reconstruction algorithm using simulated annealing
RU2005114601A (en) METHOD FOR ACCELERATED SEARCH FOR WIDEBAND SIGNALS AND DEVICE FOR ITS IMPLEMENTATION
Borwein et al. The merit factor problem
KR20180078712A (en) Method and apparatus for performing graph ranking
PACHOCKI et al. Where to Use and How not to Use Polynomial String Hashing.
KR100772399B1 (en) Method for generating patch file and computer readable recording medium storing program for performing the method
US20110071990A1 (en) Fast History Based Compression in a Pipelined Architecture
Wiklund et al. Multifractality of the Lorenz system
Chitrakar et al. Approximate search with constraints on indels with application in SPAM filtering
WO2019122664A1 (en) Method for improving the execution time of a computer application
CN116089491B (en) Retrieval matching method and device based on time sequence database

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20191206

RJ01 Rejection of invention patent application after publication