CN106201434A - Reversible random number generator - Google Patents

Reversible random number generator Download PDF

Info

Publication number
CN106201434A
CN106201434A CN201610523036.7A CN201610523036A CN106201434A CN 106201434 A CN106201434 A CN 106201434A CN 201610523036 A CN201610523036 A CN 201610523036A CN 106201434 A CN106201434 A CN 106201434A
Authority
CN
China
Prior art keywords
random number
seed
reversible
current
function
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.)
Granted
Application number
CN201610523036.7A
Other languages
Chinese (zh)
Other versions
CN106201434B (en
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.)
Nantong Institute of Technology
Original Assignee
Nantong Institute of Technology
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 Nantong Institute of Technology filed Critical Nantong Institute of Technology
Priority to CN201610523036.7A priority Critical patent/CN106201434B/en
Publication of CN106201434A publication Critical patent/CN106201434A/en
Application granted granted Critical
Publication of CN106201434B publication Critical patent/CN106201434B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

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)
  • Complex Calculations (AREA)
  • Supply And Distribution Of Alternating Current (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a kind of reversible random number generator, for the one in reversible maker based on memorizer, equally distributed reversible maker, other reversible makers being distributed.The reversible random number generator of the present invention can generate random number series by forward Generating Random Number, can also push back random number series, excellent performance, good working effect according to the random number of current output by reverse Generating Random Number simultaneously.

Description

Reversible random number generator
Technical field
The present invention relates to a kind of reversible random number generator.
Background technology
Probability distribution is used for analog physical system model by computer code, and random number generator is used to generate and meets one Determine the ordered series of numbers of probability distribution.Generating random number ordered series of numbers the most studied for many years, main research contents has: (1) is in certain essence In the range of degree, increasing the length of random number, (2) improve the speed of maker, and (3) generate complex distributions ordered series of numbers, and (4) reduce multiple Influencing each other between ordered series of numbers.But, about maker reversible in terms of the most studied or consider.Although it has with these researchs A lot of aspects intersected, but it does not the most receive significant attention.
Summary of the invention
It is an object of the invention to provide one and can generate random number series by forward Generating Random Number, the most also The reversible random number generator of random number series can be pushed back by reverse Generating Random Number according to the random number of current output.
The technical solution of the present invention is:
A kind of reversible random number generator, is characterized in that: for reversible maker based on memorizer, equally distributed reversible One in maker, other reversible makers being distributed:
(1) reversible maker based on memorizer:
A given size is the space of Mz position, and the precision of each random number is B position, then the length of reversible random number sequence Degree is M=Mz/B;
Forward and the method reversely traveling through a random number ordered series of numbers is included based on the reversible random number algorithm of memorizer;Forward with Machine number ordered series of numbers is generated by function R* (x);Algorithm one size of use is that the cyclic buffer B of M is reversible to realize;This circulation is slow Rushing district's subscript span is from 0 to M-1, and h is head pointer, and c is current pointer, and t is tail pointer,
(a) forward
B () is reverse
R-1(x):
C=(c-1) mod M
U=B [c]
return u;
Flow process is: beginning → h!=t → B [t]=R* () → amendment tail pointer t=(t+1) modM;Then terminate or return →h!=t step;
(2) equally distributed reversible maker:
One equally distributed PRNG forward and the algorithm of reverse execution:
(a) forward
R():
Y=f (x)
U=U (y)
return u;
B () is reverse
R-1():
Y=f-1(x)
U=U (y)
return u;
F (x) is from the next seed of current seed calculating, and f-1X () is to calculate above seed from current seed; U (x) map seed to interval [0,1);U (x) had both been used for forward calculating and had also been used for backwards calculation;
Direct algorithms flow process: produce initial seed value x0→ calculate next seed X according to previous seedn=f (xn-1) → map current random number Un=U (Xn) → current random number is saved in memorizer;Then export or return step: Next seed X is calculated according to previous seedn=f (xn-1);
The formula of F (x) is:
Wherein: a is multiplier, 0 < a < M;C is increment, 0≤c < M;M is modulus, and M > 0 generally takes the integral number power of 2; x0For seed, 0≤x0< M;The most relatively prime for meeting preferable statistical property, a and M and c and M;
Inverse algorithm flow process: current random number xn+1→ calculate next seed X according to previous seedn=f-1 (xn+1) → map current random number Un=U (Xn) → current random number is saved in memorizer;Then export or return step: Next seed X is calculated according to previous seedn=f-1(xn+1);
F-1X the formula of () is:
Wherein: b=am-2modm;
(3) the reversible maker of other distributions:
The PRNG forward of other distributions and inverse algorithm
(a) forward
R():
Y=f (x)
S=S (y)
U=U (s)
return u;
B () is reverse
R-1():
Y=f-1 (x)
S=S-1 (y)
U=U (s)
return u;
F () is from the next seed of current seed calculating, and f-1() is to calculate above seed from current seed;S () is that transforming function transformation function realizes different distributions, U () map seed to interval [0,1);U () had both been used for forward calculating and had also been used for Backwards calculation;
Wherein: S - 1 ( x ) = - log x λ x ∈ [ 0 , 1 ] 0 o t h e r w i s e ;
The above-mentioned implication about letter:
U is function U (Xn)
U is the value of function, and formula is: un=U (xn)
S is function S (Xn)
S is the value of function, and formula is: sn=S (xn)
E is the truth of a matter of natural logrithm, is a nonterminating and non-recurring decimal;
λ represents eigenvalue
Y is the value of function.
The reversible random number generator of the present invention can generate random number series by forward Generating Random Number, also may be used simultaneously Random number series, excellent performance, good working effect is pushed back by reverse Generating Random Number with the random number according to current output.
The invention will be further described with embodiment below in conjunction with the accompanying drawings.
Fig. 1 is reversible random number generator schematic diagram.
Fig. 2 is forward random number generator schematic diagram based on memorizer.
Fig. 3 is forward random number generator memory space schematic diagram based on memorizer.
Fig. 4 is based on memorizer reversible random number algorithm schematic flow sheet.
Fig. 5 is equally distributed reversible maker forward random number generator algorithm schematic flow sheet.
Fig. 6 is equally distributed reversible maker reverse random number generator algorithm schematic flow sheet.
Detailed description of the invention
Reversible random number generator can generate random number series by forward Generating Random Number, simultaneously can also basis The random number of current output pushes back random number series by reverse Generating Random Number, as shown in Figure 1;
In order to pay a return visit generating random number sequence accurately, traditional method is to use each random number being generated The base value of test point.This method can solve the problem that correctness problem, but the resource of wasting because this need to consume substantial amounts of in Deposit the time of space and memory copying.In order to avoid test point, reversible method the most quickly runs into one newly attempting when Problem, having some random number generators is based on damaging or destructive calculating, such as modulo operation.This means that reversible Calculate and there is no ratio based on checkpoint more effective way.In order to solve such problem, it is necessary to exploitation need not any inspection Make an inventory of the reversible random number generator that just can pay a return visit random number sequence.In theory, such random number generator is implicitly present in, because of Being the numerical value in cyclic sequence for random number sequence, it should the forward of difficulty and reversely traversal on an equal basis.
Here, propose three kinds of effective reversible random number generator methods both can also reversely to travel through with forward traversal.
(1) reversible maker based on memorizer
(2) equally distributed reversible maker
(3) the reversible maker of other distributions
1, reversible maker based on memorizer
A general method is had to be suitable for all of reversible random number generator here.Any reversible random number generator The random number of generation can be saved in computer storage and enables them to reverse because simplest reversible can be with base In forward random number series last in, first out operation.This is one and takes most space, but the most general method, because he need not calculate The random number generated.Such as, random number derive from atmospheric radiation can use easily method based on memorizer realize can Inverse.Because random number generator or pseudo random number whether based on physics are all very difficult to by calculating reversible, but reversibility Can be easily by forward sequential recording being gone in memory realization.Memorizer may be filled out during using Full, therefore, the capacity of memorizer determines the length of reversible random number sequence.
A given size is the space of Mz position, and the precision of each random number is B position, then the length of reversible random number sequence Degree is M=Mz/B.As shown in Figure 3.
This cyclic buffer subscript span is from 0 to M-1, and h is head pointer, and c is current pointer, and t is tail pointer. Based on the reversible random number algorithm of memorizer as shown in Figure 4;
Algorithm illustrates forward and the method reversely traveling through a random number ordered series of numbers.Forward random number ordered series of numbers is by function R* X () generates, and the inverse function of R* (x) or do not exist, physics is irreversible, or it is the highest to calculate cost, algorithm uses one Individual size is that the cyclic buffer B of M is reversible to realize.This cyclic buffer subscript span is from 0 to M-1, and h is that head refers to Pin, c is current pointer, and t is tail pointer, as shown in Figure 3.
(a) forward
B () is reverse
R-1(x):
C=(c-1) mod M
U=B [c]
return u;
2, equally distributed reversible maker
The most traditional random number generator be generate [0,1) interval equally distributed variable, other complex distributions random Number ordered series of numbers can be based on this equally distributed generating random number.The most equally distributed random number generator is other sequences Basis.Thus reversible in order to be other complex distributions ordered series of numbers it may first have to exploitation is uniformly distributed reversible maker.
One equally distributed PRNG forward and reverse execution are presented at algorithm.Formula f (x) is from working as The next seed of front seed calculating, and f-1X () is to calculate above seed from current seed.Formula U (x) maps seed Value to interval [0,1).Notice that formula U (x) had both been used for forward calculating and has also been used for backwards calculation.Forward random number algorithm flow process As it is shown in figure 5, reverse random number algorithm flow process is as shown in Figure 6.
The formula of F (x) is:
Wherein: a is multiplier, 0 < a < M;C is increment, 0≤c < M;M is modulus, M >
0, generally take the integral number power of 2;x0For seed, 0≤x0< M;For meeting preferably statistics
Character, a and M and c and M are the most relatively prime.
F-1X the formula of () is:
Wherein: b=am-2mod m
(a) forward
R():
Y=f (x)
U=U (y)
return u;
B () is reverse
R-1():
Y=f-1(x)
U=U (y)
return u;
3, the reversible maker of other distributions
The reversible random number number maker of other distributions can add based on the basis of equally distributed random number generator Upper shuffling algorithm scheduling algorithm so that generate equally distributed ordered series of numbers and meet other distributions.
PRNG forward and the reverse execution of one other distribution are presented at algorithm.Formula f () is from working as The next seed of front seed calculating, and f-1() is to calculate above seed from current seed.Formula S () is transforming function transformation function Realize different distributions, formula U () map seed to interval [0,1).Notice that formula U () had both been used for forward calculating and has also been used for Backwards calculation.
(a) forward
R():
Y=f (x)
S=S (y)
U=U (s)
return u;
B () is reverse
R-1():
Y=f-1 (x)
S=S-1 (y)
U=U (s)
return u;
Wherein:
Function f (), f-1(), U () are with reference to based on equally distributed random number generator.

Claims (1)

1. a reversible random number generator, is characterized in that: for reversible maker based on memorizer, equally distributed reversible life Grow up to be a useful person, other distribution reversible makers in one:
(1) reversible maker based on memorizer:
A given size is the space of Mz position, and the precision of each random number is B position, then reversible random number sequence a length of M=Mz/B;
Forward and the method reversely traveling through a random number ordered series of numbers is included based on the reversible random number algorithm of memorizer;Forward random number Ordered series of numbers is generated by function R* (x);Algorithm one size of use is that the cyclic buffer B of M is reversible to realize;This cyclic buffer Subscript span is from 0 to M-1, and h is head pointer, and c is current pointer, and t is tail pointer,
(a) forward
B () is reverse
Flow process is: beginning → h!=t → B [t]=R* () → amendment tail pointer t=(t+1) modM;Then terminate or return → h! =t step;
(2) equally distributed reversible maker:
One equally distributed PRNG forward and the algorithm of reverse execution:
(a) forward
R():
Y=f (x)
U=U (y)
return u;
B () is reverse
R-1():
Y=f-1(x)
U=U (y)
return u;
F (x) is from the next seed of current seed calculating, and f-1X () is to calculate above seed from current seed;U(x) Map seed to interval [0,1);U (x) had both been used for forward calculating and had also been used for backwards calculation;
Direct algorithms flow process: produce initial seed value x0→ calculate next seed X according to previous seedn=f (xn-1) → map current random number Un=U (Xn) → current random number is saved in memorizer;Then export or return step: according to Previous seed calculates next seed Xn=f (xn-1);
The formula of F (x) is:
Wherein: a is multiplier, 0 < a < M;C is increment, 0≤c < M;M is modulus, and M > 0 generally takes the integral number power of 2;x0For planting Son, 0≤x0< M;The most relatively prime for meeting preferable statistical property, a and M and c and M;
Inverse algorithm flow process: current random number xn+1→ calculate next seed X according to previous seedn=f-1(xn+1)→ Map current random number Un=U (Xn) → current random number is saved in memorizer;Then export or return step: according to front One seed calculates next seed Xn=f-1(xn+1);
F-1X the formula of () is:
Wherein: b=am-2modm;
(3) the reversible maker of other distributions:
The PRNG forward of other distributions and inverse algorithm
(a) forward
R():
Y=f (x)
S=S (y)
U=U (s)
return u;
B () is reverse
R-1():
Y=f-1 (x)
S=S-1 (y)
U=U (s)
return u;
F () is from the next seed of current seed calculating, and f-1() is to calculate above seed from current seed;S () is Transforming function transformation function realizes different distributions, U () map seed to interval [0,1);U () had both been used for forward calculating and had also been used for reversely Calculate;
Wherein:
S - 1 ( x ) = { - l o g x λ x ∈ [ 0 , 1 ] 0 o t h e r w i s e ;
The above-mentioned implication about letter:
U is function U (Xn)
U is the value of function, and formula is: un=U (xn)
S is function S (Xn)
S is the value of function, and formula is: sn=S (xn)
E is the truth of a matter of natural logrithm, is a nonterminating and non-recurring decimal;
λ represents eigenvalue
Y is the value of function.
CN201610523036.7A 2016-07-05 2016-07-05 Reversible random number generator Expired - Fee Related CN106201434B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610523036.7A CN106201434B (en) 2016-07-05 2016-07-05 Reversible random number generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610523036.7A CN106201434B (en) 2016-07-05 2016-07-05 Reversible random number generator

Publications (2)

Publication Number Publication Date
CN106201434A true CN106201434A (en) 2016-12-07
CN106201434B CN106201434B (en) 2018-07-10

Family

ID=57466275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610523036.7A Expired - Fee Related CN106201434B (en) 2016-07-05 2016-07-05 Reversible random number generator

Country Status (1)

Country Link
CN (1) CN106201434B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN86102265A (en) * 1985-03-04 1986-09-03 约翰·弗兰克制造公司 The fast functional testing method and the system thereof of random access memory (RAM)
JPH01206718A (en) * 1988-02-12 1989-08-18 Fujitsu Ltd Random number generator
JPH04123130A (en) * 1990-09-13 1992-04-23 Nippon Telegr & Teleph Corp <Ntt> Generating circuit for pseudo random number conforming to arbitrary probability distribution
US6609139B1 (en) * 1998-06-16 2003-08-19 Deutsche Telekom Ag Method for generating a random number on a quantum-mechanical basis and random number generator
US20030236803A1 (en) * 2002-06-24 2003-12-25 Emrys Williams Apparatus and method for random number generation
CN103324462A (en) * 2013-05-24 2013-09-25 深圳职业技术学院 True random number generation system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN86102265A (en) * 1985-03-04 1986-09-03 约翰·弗兰克制造公司 The fast functional testing method and the system thereof of random access memory (RAM)
JPH01206718A (en) * 1988-02-12 1989-08-18 Fujitsu Ltd Random number generator
JPH04123130A (en) * 1990-09-13 1992-04-23 Nippon Telegr & Teleph Corp <Ntt> Generating circuit for pseudo random number conforming to arbitrary probability distribution
US6609139B1 (en) * 1998-06-16 2003-08-19 Deutsche Telekom Ag Method for generating a random number on a quantum-mechanical basis and random number generator
US20030236803A1 (en) * 2002-06-24 2003-12-25 Emrys Williams Apparatus and method for random number generation
CN103324462A (en) * 2013-05-24 2013-09-25 深圳职业技术学院 True random number generation system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
LIHUI NI ET AL: "A General Method of Constructing the Reversible Full-adder", 《THIRD INTERNATIONAL SYMPOSIUM ON INTELLIGENT INFORMATION TECHNOLOGY AND SECURITY INFORMATICS》 *
卫丽华: "可逆编程语言相关理论及实践研究", 《软件导刊》 *
朱鹏程 等: "可逆排序算法的分析与实现", 《计算机仿真》 *
管致锦 等: "基于正反控制模型的可逆逻辑综合", 《计算机学报》 *

Also Published As

Publication number Publication date
CN106201434B (en) 2018-07-10

Similar Documents

Publication Publication Date Title
Swanson Path integrals and quantum processes
Hallgren Linear congruential generators over elliptic curves
CN102289425B (en) Hash algorithm based on extensible precision chaos
CN104238995B (en) A kind of nonlinear feedback shift register
CN105634018A (en) Random response surface method and interior point method based wind-power-plant-contained random optimal power flow solving method
CN103399726A (en) Streamlined combined-type pseudo-random number generator
Creswick Transfer matrix for the restricted canonical and microcanonical ensembles
CN104536831A (en) Multi-core SoC software mapping method based on multi-objective optimization
CN106201434A (en) Reversible random number generator
Tezuka et al. A Method of Designing Cellular Automata
Childs et al. Exact sampling from nonattractive distributions using summary states
Bröker et al. Elliptic curves with a given number of points
CN106708973A (en) Method for accelerating Monte Carlo converse solution of PageRank problems
CN110109913A (en) A kind of zerocash digs the hardware implementation method and device of mine algorithm
Charbonneau A Maunder minimum scenario based on cross-hemispheric coupling and intermittency
Konstantinou et al. On the efficient generation of elliptic curves over prime fields
CN114741956A (en) Carbon emission flow tracking method based on graph neural network
Deng et al. Improving random number generators in the Monte Carlo simulations via twisting and combining
Hausmann et al. Stationary properties of a randomly driven Ising ferromagnet
Kozierski et al. Parallel uniform random number generator in FPGA
Cagigal et al. Algorithmic determination of linear-feedback in a shift register for pseudorandom binary sequence generation
Indaco et al. An efficient many-core architecture for Elliptic Curve Cryptography security assessment
Darmon Heegner points, Stark-Heegner points, and values of L-series
Antonov Random number generator based on multiplicative convolution transform
Kozierski et al. Implementation of fast uniform random number generator on FPGA

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180710

Termination date: 20190705