CN106201434B - Reversible random number generator - Google Patents

Reversible random number generator Download PDF

Info

Publication number
CN106201434B
CN106201434B CN201610523036.7A CN201610523036A CN106201434B CN 106201434 B CN106201434 B CN 106201434B CN 201610523036 A CN201610523036 A CN 201610523036A CN 106201434 B CN106201434 B CN 106201434B
Authority
CN
China
Prior art keywords
random number
seed
current
reversible
generator
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.)
Expired - Fee Related
Application number
CN201610523036.7A
Other languages
Chinese (zh)
Other versions
CN106201434A (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)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Supply And Distribution Of Alternating Current (AREA)

Abstract

The invention discloses a kind of reversible random number generator, for one kind in the reversible generator based on memory, equally distributed reversible generator, other reversible generators being distributed.The reversible random number generator of the present invention can generate random number series, while can also push back random number series by reverse Generating Random Number according to the random number currently exported by positive Generating Random Number, have excellent performance, good working effect.

Description

Reversible random number generator
Technical field
The present invention relates to a kind of reversible random number generators.
Background technology
Probability distribution is used for analog physical system model by computer code, and random number generator, which is used to generate, meets one Determine the ordered series of numbers of probability distribution.Generation random number ordered series of numbers has been studied for many years, and main research contents has:(1) in certain essence In the range of degree, increase the length of random number, (2) improve the speed of generator, and (3) generation complex distributions ordered series of numbers, (4) reduce multiple Influencing each other between ordered series of numbers.However, about generator it is reversible in terms of it is seldom studied or consider.Although it has with these researchs The aspect much intersected, but it is received significant attention not yet.
Invention content
The purpose of the present invention is to provide one kind to generate random number series by positive Generating Random Number, while The reversible random number generator of random number series can be pushed back by reverse Generating Random Number according to the random number currently exported.
The present invention technical solution be:
A kind of reversible random number generator, it is characterized in that:For the reversible generator based on memory, equally distributed reversible One kind in generator, other reversible generators being distributed:
(1) the reversible generator based on memory:
The space that a given size is Mz, the precision of each random number is B, then the length of reversible random number sequence It spends for M=Mz/B;
Include the method for forward and reverse one random number ordered series of numbers of traversal based on the reversible random number algorithm of memory;Forward direction with Machine number ordered series of numbers is generated by function R* (x);Algorithm is reversible to realize for the cyclic buffer B of M using a size;This cycle is slow It is from 0 to M-1 to rush area's subscript value range, and h is head pointer, and c is current pointer, and t is tail pointer,
(a) it is positive
(b) reversely
R-1(x):
C=(c-1) mod M
U=B [c]
return u;
Flow is:Beginning → h!=t → B [t]=R* () → modification tail pointer t=(t+1) modM;Then terminate or return →h!=t steps;
(2) equally distributed reversible generator:
One equally distributed pseudo-random number generator forward direction and the algorithm of reverse execution:
(a) it is positive
R():
Y=f (x)
U=U (y)
return u;
(b) reversely
R-1():
Y=f-1(x)
U=U (y)
return u;
F (x) calculates next seed from current seed, and f-1(x) it is to calculate front seed from current seed; U (x) map seed to section [0,1);U (x) had both been used for positive calculating or had been used for backwards calculation;
Direct algorithms flow:Generate initial seed value x0→ according to the next seed X of previous seed calculatingn=f (xn-1) → mapping current random number Un=U (Xn) → current random number is saved in memory;Then output or return to 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, M > 0, usually takes 2 integral number power; x0For seed, 0≤x0< M;It is relatively prime to meet preferable statistical property, a and M and c and M;
Inverse algorithm flow:Current random number xn+1→ according to the next seed X of previous seed calculatingn=f-1 (xn+1) → mapping current random number Un=U (Xn) → current random number is saved in memory;Then output or return to step: Next seed X is calculated according to previous seedn=f-1(xn+1);
F-1(x) formula is:
Wherein:B=am-2modm;
(3) the reversible generator of other distributions:
The pseudo-random number generator forward direction and inverse algorithm of other distributions
(a) it is positive
R():
Y=f (x)
S=S (y)
U=U (s)
return u;
(b) reversely
R-1():
Y=f-1 (x)
S=S-1 (y)
U=U (s)
return u;
F () calculates next seed from current seed, and f-1() is to calculate front seed from current seed;S () for transforming function transformation function realize different distributions, U () map seed to section [0,1);U () be both used for it is positive calculate and also by with In backwards calculation;
The above-mentioned meaning in relation to 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 characteristic value
Y is the value of function.
The reversible random number generator of the present invention can generate random number series, while also may be used by positive Generating Random Number To push back random number series by reverse Generating Random Number according to the random number currently exported, it has excellent performance, good working effect.
The invention will be further described with reference to the accompanying drawings and examples.
Fig. 1 is reversible random number generator schematic diagram.
Fig. 2 is the positive random number generator schematic diagram based on memory.
Fig. 3 is the positive random number generator memory space schematic diagram based on memory.
Fig. 4 is based on the reversible random number algorithm flow diagram of memory.
Fig. 5 is equally distributed reversible generator forward direction random number generator algorithm flow diagram.
Fig. 6 is the reverse random number generator algorithm flow diagram of equally distributed reversible generator.
Specific embodiment
Reversible random number generator can generate random number series, while can also basis by positive Generating Random Number The random number currently exported pushes back random number series by reverse Generating Random Number, as shown in Figure 1;
In order to accurately pay a return visit generating random number sequence, traditional method is using the random number being each generated The base value of test point.This method can solve correctness problem, but waste resource, because this needs to consume in a large amount of Deposit the time of space and memory copying.In order to avoid test point, reversible method encounters one newly quickly again when attempting The problem of, some random number generators are based on damaging or destructive calculate, such as modulo operation.This means that reversible It calculates not than being based on checkpoint more effective way.In order to solve the problems, it is necessary to which exploitation does not need to any inspection Make an inventory of the reversible random number generator with regard to random number sequence can be paid a return visit.Theoretically, such random number generator is implicitly present in, because It is the numerical value in cyclic sequence for random number sequence, it the forward direction of difficulty should can be traversed with reversed on an equal basis.
Here, propose that three kinds of effective reversible random number generator methods positive can traverse or reversely traverse.
(1) the reversible generator based on memory
(2) equally distributed reversible generator
(3) the reversible generator of other distributions
1st, the reversible generator based on memory
It is suitble to all reversible random number generators there are one general method here.Any reversible random number generator The random number of generation can be preserved and in computer storage and enable them to reverse because it is simplest it is reversible can be with base In positive random number series last in, first out operation.This is one and most takes space, but most general method, because he does not need to calculate The random number of generation.For example, random number can easily use the method realization based on memory can from atmospheric radiation It is inverse.Because the random number generator or pseudo random number whether based on physics are all very difficult to, but invertibity reversible by calculating It can be easily by the way that positive sequential recording be gone to realize in memory.Memory may be filled out during use Full, therefore, the capacity of memory determines the length of reversible random number sequence.
The space that a given size is Mz, the precision of each random number is B, then the length of reversible random number sequence It spends for M=Mz/B.As shown in Figure 3.
This cyclic buffer subscript value range is from 0 to M-1, and h is head pointer, and c is current pointer, and t is tail pointer. It is as shown in Figure 4 based on the reversible random number algorithm of memory;
Algorithm illustrates the method that forward and reverse traverses a random number ordered series of numbers.Positive random number ordered series of numbers is by function R* (x) generate, or and the inverse function of R* (x) be not present either physics it is irreversible or calculate cost it is very high, algorithm use one A size is realized reversible for the cyclic buffer B of M.This cyclic buffer subscript value range is from 0 to M-1, and h refers to for head Needle, c are current pointer, and t is tail pointer, as shown in Figure 3.
(a) it is positive
(b) reversely
R-1(x):
C=(c-1) mod M
U=B [c]
return u;
2nd, equally distributed reversible generator
Most traditional random number generator be generation [0,1) the equally distributed variable in section, other complex distributions it is random Number ordered series of numbers can be based on this equally distributed generating random number.Therefore equally distributed random number generator is other sequences Basis.Thus in order to which other complex distributions ordered series of numbers are reversible it may first have to which exploitation is uniformly distributed reversible generator.
One equally distributed pseudo-random number generator forward direction and reverse execution are presented in algorithm.Formula f (x) from work as The next seed of preceding seed calculating, and f-1(x) it is to calculate front seed from current seed.Formula U (x) maps seed It is worth section [0,1).Notice that formula U (x) had both been used for positive calculating or had been used for backwards calculation.Positive random number algorithm flow As shown in figure 5, reverse random number algorithm flow 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, usually take 2 integral number power;x0For seed, 0≤x0< M;To meet preferable statistics
Property, a and M and c and M are relatively prime.
F-1(x) formula is:
Wherein:B=am-2mod m
(a) it is positive
R():
Y=f (x)
U=U (y)
return u;
(b) reversely
R-1():
Y=f-1(x)
U=U (y)
return u;
3rd, the reversible generator of other distributions
The reversible random number number generator of other distributions can be based on adding 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.
One other distribution pseudo-random number generator forward direction and reverse execution be presented in algorithm.Formula f () from work as The next seed of preceding seed calculating, and f-1() is to calculate front seed from current seed.Formula S () is becomes exchange the letters Number realization different distributions, formula U () mapping seeds to section [0,1).Pay attention to formula U () be both used for it is positive calculate and also by For backwards calculation.
(a) it is positive
R():
Y=f (x)
S=S (y)
U=U (s)
return u;
(b) reversely
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 kind of reversible random number generator, it is characterized in that:The reversible random number generator is the reversible life based on memory It grows up to be a useful person, one kind in equally distributed reversible generator, other reversible generators being distributed:
(1) the reversible generator based on memory:
The space that a given size is Mz, the precision of each random number is b, then the length of reversible random number sequence is L=Mz/b;
Include the method for forward and reverse one random number ordered series of numbers of traversal based on the reversible random number algorithm of memory;Positive random number Ordered series of numbers is by function R*(x) it generates;Algorithm is reversible to realize for the cyclic buffer B of M using a size;This cyclic buffer Subscript value range is from 0 to M-1, and H is head pointer, and C is current pointer, and T is tail pointer,
(a) forward direction R (x)
Step 1:When head pointer is not equal to tail pointer, by function R*(x) value of cyclic buffer B, B [T]=R are generated*(x), and Tail pointer T=(T+1) mod M are changed, until cycle terminates;
Step 2:The current value u=B [C] of random number ordered series of numbers is taken out from the B of cyclic buffer according to current pointer C, modification is current Pointer is directed toward next node C=(C+1) mod M;
(b) reversed R-1(x)
Step 1:Current pointer is changed, is directed toward previous node C=(C-1) mod M
Step 2:The current value u=B [C] of random number ordered series of numbers is taken out from the B of cyclic buffer according to current pointer C;
Flow is:Beginning → H!=T → B [T]=R* () → modification tail pointer T=(T+1) mod M;Then terminate or return → H!=T steps;
(2) equally distributed reversible generator:
One equally distributed pseudo-random number generator forward direction and the algorithm of reverse execution:
F (x) calculates next seed from current seed, and f-1(x) it is to calculate front seed from current seed;U() Map seed to section [0,1);U () had both been used for positive calculating or had been used for backwards calculation;
Direct algorithms flow:Generate initial seed value x0→ according to the next seed x of previous seed calculatingn=f (xn-1) → mapping current random number un=U (xn) → current random number is saved in memory;Then output or return to step:According to Previous seed calculates next seed xn=f (xn-1);
The formula of f (x) is:xn=(axn-1+c)mod m
un=xn/ m, n=1,2,3...L
Wherein:A is multiplier, 0 < a < m;C is increment, 0≤c < m;M is modulus, m > 0, usually takes 2 integral number power;x0It is first Beginning seed, 0≤x0< m;It is relatively prime to meet preferable statistical property, a and m and c and m;
Inverse algorithm flow:Current random number xn+1→ according to the current seed calculating seed x of front onen=f-1(xn+1)→ Map current random number un=U (xn) → current random number is saved in memory;Then output or return to step:According to work as Preceding seed calculates the seed x of front onen=f-1(xn+1);
f-1(x) formula is:xn=(bxn+1-c)mod m
un=xn/ m, n=1,2,3...L
Wherein:B=am-2mod m;
(3) the reversible generator of other distributions:
The pseudo-random number generator forward direction and inverse algorithm of other distributions
Direct algorithms flow:Generate initial seed value x0→ according to the next seed x of previous seed calculatingn=f (xn-1) → generation sn=S (xn) transformed value → mapping current random number un=U (sn) → current random number is saved in memory;So Output or return to step afterwards:Next seed x is calculated according to previous seedn=f (xn-1);
The formula of f (x) is:xn=(axn-1+c)mod m
un=xn/ m, n=1,2,3...L
Wherein:A is multiplier, 0 < a < m;C is increment, 0≤c < m;M is modulus, m > 0, usually takes 2 integral number power;x0For kind Son, 0≤x0< m;It is relatively prime to meet preferable statistical property, a and m and c and m;
The formula of S (x) is:
Inverse algorithm flow:Current random number xn+1→ according to the current seed calculating seed x of front onen=f-1(xn+1)→ Generate sn=S-1(xn) transformed value → mapping current random number un=U (sn) → current random number is saved in memory;Then Output or return to step:The seed x of front one is calculated according to current seedn=f-1(xn+1);
f-1(x) formula is:xn=(bxn+1-c)mod m
un=xn/ m, n=1,2,3...L
Wherein:B=am-2mod m;
S-1(x) formula is:
F () calculates next seed from current seed, and f-1() is to calculate front seed from current seed;S () is Transforming function transformation function realization different distributions, U () mapping seeds to section [0,1);U () had both been used for positive calculating or had been used for anti- To calculating;
The above-mentioned meaning in relation to 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 characteristic value
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 CN106201434A (en) 2016-12-07
CN106201434B true 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 (5)

* 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
CN103324462A (en) * 2013-05-24 2013-09-25 深圳职业技术学院 True random number generation system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028059B2 (en) * 2002-06-24 2006-04-11 Sun Microsystems, Inc. Apparatus and method for random number generation

Patent Citations (5)

* 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
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
A General Method of Constructing the Reversible Full-adder;Lihui Ni et al;《Third International Symposium on Intelligent Information Technology and Security Informatics》;20101231;全文 *
可逆排序算法的分析与实现;朱鹏程 等;《计算机仿真》;20150331;第32卷(第3期);全文 *
可逆编程语言相关理论及实践研究;卫丽华;《软件导刊》;20150228;第14卷(第2期);全文 *
基于正反控制模型的可逆逻辑综合;管致锦 等;《计算机学报》;20080531;第31卷(第5期);全文 *

Also Published As

Publication number Publication date
CN106201434A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
Zuckerman General weak random sources
Mayeda et al. Generation of trees without duplications
Goldreich et al. On the existence of pseudorandom generators
US10534576B2 (en) Optimization apparatus and control method thereof
Masoodi et al. An analysis of linear feedback shift registers in stream ciphers
CN100579006C (en) RSA ciphering method for realizing quick big prime generation
WO2012016588A1 (en) Bit sequence generator
Hallgren Linear congruential generators over elliptic curves
CN106201434B (en) Reversible random number generator
Chao et al. Design of elliptic curves with controllable lower boundary of extension degree for reduction attacks
Thane et al. Hardware design and implementation of pseudorandom number generator using piecewise linear chaotic map
CN103023659A (en) ECC (elliptic curve cryptosystem) encryption hardware device with expandable parameter bit width
Moghadam et al. Designing a random number generator with novel parallel LFSR substructure for key stream ciphers
CN108510429A (en) A kind of multivariable cryptographic algorithm parallelization accelerated method based on GPU
TWI387921B (en) A normal distributed random number generator by using the clt and the random number generating method thereof
Konstantinou et al. On the efficient generation of elliptic curves over prime fields
CN103210449B (en) For the pipeline architecture of Scalable Performance on storer
Shobana et al. Optimization of Unit Commitment Problem and Constrained Emission Using Genetic Algorithm
Chugunkov et al. New class of pseudorandom number generators for logic encryption realization
Mukherjee et al. High-speed on-chip event counters for embedded systems
KR100564764B1 (en) Finite field polynomial multiplier and Method thereof
Deng et al. Improving random number generators in the Monte Carlo simulations via twisting and combining
WO2022267038A1 (en) Random sequence generation method and apparatus, device, and medium
CN102591618A (en) Method for generating big prime in embedded system
RU2812412C1 (en) Device for forming triplex numbers

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