The content of the invention
The purpose of the application is intended at least solve one of above-mentioned technical problem to a certain extent.
Therefore, first purpose of the application is to propose a kind of generation method of random number, this method is included N number of by generation
The random number storage array of memory cell storage random number, then stores the memory cell in array to random number and is mixed at random
Row, when receiving random number acquisition instruction, corresponding memory cell reads random number from random number storage array, by this
Apply for embodiment, the random number repetitive rate that can be repeatedly obtained within the shorter unit interval is low, and distributing equilibrium, therefore this
The random digit generation method of application has preferable randomness.
Second purpose of the application is to propose a kind of generating means of random number.
The 3rd purpose of the application is to propose a kind of acquisition methods of random number.
The 4th purpose of the application is to propose a kind of acquisition device of random number.
For up to above-mentioned purpose, a kind of generation method of the random number proposed according to the application first aspect embodiment, including it is following
Step:Random number storage array is generated, wherein, the random number storage array includes N number of memory cell, each described to deposit
Storage unit stores a random number, wherein, N is positive integer;To the random number store array in memory cell carry out with
Machine mixing;And random number acquisition instruction is received, and instruction is obtained from the random number stores array according to the random number
The random number of the memory cell storage is read in corresponding memory cell.
By the random digit generation method of the embodiment of the present application, firstly generate and deposited including N number of memory cell and each memory cell
The random number storage array of one random number of storage, the memory cell then stored to random number in array carries out random mixing, from
And memory cell can be read in corresponding memory cell from random number storage array when receiving random number acquisition instruction
The random number of storage.Due to having carried out random mixing to memory cell in random number storage array, it is achieved thereby that shorter
Unit interval in the random number repetitive rate that repeatedly obtains it is low, and distributing equilibrium.Therefore the random digit generation method of the application has
There is preferable randomness.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
In one embodiment of the application, the generation method of described random number, each memory cell has ident value,
Wherein, the memory cell progress mixing stored to the random number in array is specifically included:According to random function generation with
Machine value, and generate according to the random value ident value of memory cell to be exchanged;And according to the ident value and default exchange
Rule is exchanged the memory cell to be exchanged and the random number in Destination Storage Unit.
It is described to be specifically included according to random function generation random value in one embodiment of the application:When i is more than 1 and small
When N, ith random value is generated according to current time and the i-th -1 time random value, wherein, i is exchange number of times;As i etc.
When 1, the ith random value is generated according to current time.
In one embodiment of the application, the default exchange rule is:It is when carrying out ith exchange, ith is random
It is worth corresponding memory cell to be exchanged with the random number in (N+1-i) memory cell.
It is described right from random number storage array according to random number acquisition instruction in one embodiment of the application
The random number that the memory cell storage is read in the memory cell answered is specifically included:Instruction is obtained according to the random number to obtain
The ident value of the current memory cell being read;Read according to the ident value of the current memory cell being read next
The random number of individual memory cell storage.
For up to above-mentioned purpose, a kind of generating means of the random number proposed according to the second aspect embodiment of the application, including:
Generation module, for generating random number storage array, wherein, the random number storage array includes N number of memory cell, often
The individual memory cell stores a random number, wherein, N is positive integer;Random mixing module, for the random number
The memory cell stored in array carries out random mixing;And read module, instructed for receiving random number acquisition, and according to
The random number obtains instruction and reads the memory cell storage in corresponding memory cell from random number storage array
Random number.
The generating random number device of the embodiment of the present application, firstly generating module generation includes N number of memory cell and each storage list
The random number storage array of member one random number of storage, then random mixing module is to the memory cell in random number storage array
Random mixing is carried out, so that read module can be right from random number storage array when receiving random number acquisition instruction
The random number of memory cell storage is read in the memory cell answered.Because random mixing module stores depositing in array to random number
Storage unit has carried out random mixing, it is achieved thereby that the random number repetitive rate repeatedly obtained within the shorter unit interval is low, and
Distributing equilibrium.Therefore the generating random number device of the application has preferable randomness.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
In one embodiment of the application, the generating means of described random number, each memory cell has ident value,
Wherein, the random mixing module includes:Ident value generates submodule, for generating random value, and root according to random function
The ident value of memory cell to be exchanged is generated according to the random value;And submodule is exchanged, for according to the ident value and in advance
If exchanging rule to be exchanged the memory cell to be exchanged and the random number in Destination Storage Unit.
In one embodiment of the application, the generating means of described random number are described when i is more than 1 and during less than N
Ident value generates submodule and generates ith random value according to current time and the i-th -1 time random value, wherein, i is exchange number of times;
When i is equal to 1, the ident value generation submodule generates the ith random value according to current time.
In one embodiment of the application, the default exchange rule is:It is when carrying out ith exchange, ith is random
It is worth corresponding memory cell to be exchanged with the random number in (N+1-i) memory cell.
In one embodiment of the application, the read module is specifically included:Acquisition submodule, for according to described random
Number obtains the ident value that instruction obtains the current memory cell being read;Reading submodule, for according to it is described it is current by
The ident value of the memory cell of reading reads the random number of next memory cell storage.
For up to above-mentioned purpose, a kind of acquisition methods of the random number proposed according to the third aspect embodiment of the application, including with
Lower step:Receive random number and obtain instruction, and obtain random number storage array, wherein, the random number storage array includes
N number of memory cell, each memory cell stores N number of storage in a random number, and random number storage array
The position of unit determined by random mixing, wherein, N is positive integer;Obtained and instructed from described random according to the random number
The random number of the memory cell storage is obtained in number storage array in corresponding memory cell.
By the random number acquisition methods of the embodiment of the present application, it is firstly received random number and obtains instruction, then obtain random number
Storage array simultaneously determines that random number stores the position of N number of memory cell in array by random mixing, so that according to receiving
Random number obtains memory cell storage is read in instruction from random number storage array random number in corresponding memory cell.Due to
Random mixing is carried out to memory cell in random number storage array, it is achieved thereby that repeatedly being obtained within the shorter unit interval
The random number repetitive rate taken is low, and distributing equilibrium.Therefore the random number acquisition methods of the application have preferable randomness.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
In one embodiment of the application, the acquisition methods of described random number, each memory cell has ident value,
Wherein, the position for storing N number of memory cell in array to the random number by following steps passes through random mixing:According to
Random function generates random value, and generates according to the random value ident value of memory cell to be exchanged;And according to the mark
Knowledge value and default rule of exchanging are exchanged the memory cell to be exchanged and the random number in Destination Storage Unit.
It is described right from random number storage array according to random number acquisition instruction in one embodiment of the application
The random number that the memory cell storage is obtained in the memory cell answered is specifically included:Instruction is obtained according to the random number to obtain
The ident value of the current memory cell being read;Obtain next according to the ident value of the current memory cell being read
The random number of individual memory cell storage.
For up to above-mentioned purpose, a kind of acquisition device of the random number proposed according to the fourth aspect embodiment of the application, including:
Receiving module, instruction is obtained for receiving random number;Random number stores array acquisition module, for obtaining random number storage number
Group, wherein, the random number storage array includes N number of memory cell, and each memory cell stores a random number,
And the position of N number of memory cell in the random number storage array is determined by random mixing, wherein, N is positive integer;
Random number acquisition module, for obtaining instruction corresponding memory cell from random number storage array according to the random number
The middle random number for obtaining the memory cell storage.
By the random number acquisition device of the embodiment of the present application, receiving module receives random number and obtains instruction first, then with
Machine number storage array acquisition module obtains random number storage array and determined by random mixing N number of in random number storage array
The position of memory cell, thus random number acquisition module according to receive random number obtain instruction from random number store array in it is right
The random number of memory cell storage is read in the memory cell answered.Due to being carried out in random number storage array to memory cell
Random mixing, it is achieved thereby that the random number repetitive rate repeatedly obtained within the shorter unit interval is low, and distributing equilibrium.Cause
The random number acquisition device of this application has preferable randomness.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
In one embodiment of the application, the random number acquisition module is specifically included:First acquisition submodule, for root
The ident value that instruction obtains the current memory cell being read is obtained according to the random number;Second acquisition submodule, for root
The random number of next memory cell storage is obtained according to the ident value of the current memory cell being read.
The aspect and advantage that the application is added will be set forth in part in the description, and partly will become bright from the following description
It is aobvious, or recognized by the practice of the application.
Embodiment
Embodiments herein is described below in detail, the example of the embodiment is shown in the drawings, wherein identical from beginning to end
Or similar label represents same or similar element or the element with same or like function.Retouched below with reference to accompanying drawing
The embodiment stated is exemplary, it is intended to for explaining the application, and it is not intended that limitation to the application.
The memory cell that the application is stored by way of random mixing to random number in array carries out random mixing so that random
Random number order completely randoms in number storage arrays, so that solving traditional random function greater probability and duplicating causes point
The unbalanced problem of cloth.When needing to obtain random number, corresponding random number can be obtained from random number storage array.
Fig. 1 is the flow chart of the generation method of the random number according to the application one embodiment.
As shown in figure 1, the generation method of the random number of the embodiment of the present application comprises the following steps:
S110, generation random number storage array, wherein, random number storage array includes N number of memory cell, and each storage is single
Member one random number of storage, wherein, N is positive integer.
In embodiments herein, the random number stored in N number of memory cell is differed.
It is understood that in embodiments herein, corresponding memory cell storage in the random number storage array of generation
Random number be unduplicated, for example, a random number of memory cell storage is 2, then other memory cell are deposited
The random number of storage is not 2.
In embodiments herein, N number of memory cell can store 1 respectively to N number of integer, so that each memory cell
The random number of storage is different from others.
In another embodiment of the application, the length of random number storage array can be configured, as needed to random
The length of number storage array is configured in advance.
S120, the memory cell stored to random number in array carries out random mixing.
It should be noted that the random mixing described in the embodiment of the present application refers to N number of memory cell in random number storage array
The random number of storage is exchanged at random, so that the order completely random of the random number stored in memory cell, so as to solve
Certainly random function greater probability duplicates and causes to be distributed unbalanced problem in the prior art.In embodiments herein,
The random number that N number of memory cell is stored can at random be exchanged using various ways, will be to this in follow-up embodiment
A little modes describe in detail.To those skilled in the art, random number can be stored using various ways and is deposited in array
The random number of storage carries out random mixing, so as to reach the purpose of the order completely random of random number, therefore is not limited to the application
The algorithm for the random exchange that following examples are previously mentioned, any algorithm that can reach above-mentioned purpose should be included in the application's
Within protection domain.
S130, reception random number obtains instruction, and obtains instruction corresponding storage from random number storage array according to random number
The random number of memory cell storage is read in unit.
Specifically, in embodiments herein, receive after random number acquisition instruction, sequentially can be deposited from random number
Corresponding random number is successively read in storage array, randomly can also be successively read from random number storage array corresponding random
Number.Certainly in embodiments herein, can also be read using other modes from random number storage array it is corresponding with
Machine number.
Specifically, in the specific embodiment of the application, after random number acquisition instruction is received, according to random number
The ident value (ident value of the i.e. last memory cell being read) that instruction obtains the current memory cell being read is obtained,
The random number that next memory cell is stored is read according to the ident value for the memory cell being currently read.
It should be noted that after random number acquisition instruction is received each time, determining whether the storage list being read
Member whether be random number storage array in last memory cell.Last in array is stored if not random number
Memory cell, then continue to read the random number of next memory cell storage.If last in random number storage array
Individual memory cell, then need to regenerate new random number storage array, that is, perform step S110.
The generation method of the random number of the embodiment of the present application, is firstly generated including N number of memory cell and the storage of each memory cell
The random number storage array of one random number, the memory cell then stored to random number in array carries out random mixing, so that
Can be when receiving random number acquisition instruction, reading memory cell is deposited in corresponding memory cell from random number storage array
The random number of storage.Due to having carried out random mixing to memory cell in random number storage array, it is achieved thereby that shorter
The random number repetitive rate repeatedly obtained in unit interval is low, and distributing equilibrium, therefore the random digit generation method of the application has
Preferable randomness.
In order that the acquisition random number flow of the application can clearly be understood by obtaining those skilled in the art, with reference to
Fig. 2 is illustrated.As shown in Figure 2:
S210, receives random number and obtains instruction.
S220, judge the current memory cell being read whether be random number storage array last.
Specifically, after random number acquisition instruction is received each time, the storage list being currently read is determined whether
Member whether be random number storage array in last memory cell.Last in array is stored if not random number
Memory cell, then continue to read the random number of next memory cell storage.
S230, if it is determined that the memory cell being currently read is last of random number storage array, initialization is random
Number storage array is, it is necessary to regenerate new random number storage array.
Specifically, it is determined that the memory cell being currently read is last of random number storage array, i.e., random number is deposited
The random number of all memory cell storage in storage array had all been read, then needed to carry out just random number storage array
Beginningization, so as to regenerate new random number storage array.
In embodiments herein, if it is determined that current memory cell is not last of random number storage array, then
It is direct that the random of memory cell storage is read in corresponding memory cell from random number storage array according to random number acquisition instruction
Number.
S240, the memory cell stored to random number in array carries out random mixing, i.e. circulation upsets in random number storage array
Each memory cell position.
In embodiments herein, circulation upsets the position of each memory cell in random number storage array, so as to
So that the order completely random of the random number stored in memory cell, and then random function greater probability goes out in the prior art for solution
Now repeat to cause to be distributed unbalanced problem., can be using various ways to N number of memory cell in embodiments herein
The random number of storage is exchanged at random, so as to reach the purpose of the order completely random of random number, therefore is not limited to this Shen
Please embodiment.
Next memory cell is deposited in S250, the ident value of the memory cell obtained according to last time, selection random number storage array
The data of storage are as will currently obtain random number.
Specifically, being obtained according to random number instructs the ident value for obtaining the current memory cell being read (i.e. last to be read
The ident value of the memory cell taken), next memory cell is read according to the ident value for the memory cell being currently read and stored
Random number, for example can sequentially read.
It should be noted that corresponding random number can also be read from random number storage array using other modes, do not limit
Sequentially corresponding random number is successively read in the embodiment of the present application from random number storage array.
The description of the generation method of random number is more embodied in order that obtaining in the application, JAVA language can be combined
Program number of seconds is illustrated, specific as follows:
A random number storage array is initialized first, is defined memory cell and is obtained ident value and random number storage array length.
Receive random number instruction after, judge current memory cell whether random number storage array last, judge currently deposits
, it is necessary to regenerate random number storage array when storage unit is not last of random number storage array, and then circulate will be with
Memory cell order in machine number storage array is upset, and the ident value of the memory cell obtained finally according to last time, selection is random
The data of next memory cell storage are as will currently obtain random number in number storage arrays.
It should be noted that the generation method of the random number of the application is not limited to realize based on JAVA language, other can be used
Computer language is realized.
The generation method of the random number of the embodiment of the present application, is firstly generated including N number of memory cell and the storage of each memory cell
The random number storage array of one random number, the memory cell then stored to random number in array carries out random mixing, so that
Can be when receiving random number acquisition instruction, reading memory cell is deposited in corresponding memory cell from random number storage array
The random number of storage.Due to having carried out random mixing to memory cell in random number storage array, it is achieved thereby that shorter
The random number repetitive rate repeatedly obtained in unit interval is low, and distributing equilibrium, therefore the random digit generation method of the application has
Preferable randomness.
The storage in array is stored to random number in order that obtaining those skilled in the art and can clearly understand in the application
The method that unit carries out random mixing, is specifically described with reference to Fig. 3.As shown in Figure 3:
S310, random value is generated according to current time and random function, wherein, each memory cell has ident value.The mark
Knowledge value is the mark for distinguishing memory cell, in embodiments herein, in original state (before i.e. random mixing)
The ident value of memory cell can be with equal with the random number stored in memory cell.
It should be noted that the concept of the random number stored in the random value and memory cell that are generated in step S310 is not
Identical, the random value of step generation is used for the ident value for determining memory cell to be exchanged.
Specifically, when i is more than 1 and less than N, ith random value is generated according to current time and the i-th -1 time random value;
And when i is equal to 1, ith random value is generated according to current time, wherein, i is exchange number of times.That is, when the
Once generate random value when, according to current time generate random value, when be not for the first time generation random value when, according to it is current when
Between and the i-th -1 time random value generation ith random value.
In embodiments herein, after generation random number storage array, each memory cell has ident value, according to random
Function generates random value, and generates the ident value of memory cell to be exchanged according to random value, so that it is determined that needing the storage exchanged
Unit.
S320, is carried out the random number in memory cell to be exchanged and Destination Storage Unit according to ident value and default rule of exchanging
Exchange.
When carrying out ith exchange, by the corresponding memory cell of ith random value and (N+1-i) memory cell with
Machine number is exchanged.
For example, after generation random number storage array, each memory cell has ident value, and ident value can distinguish difference
Memory cell.When i is 1, the 1st random value is generated according to current time, and treat according to the 1st random value generation
The ident value of memory cell is exchanged, rule is exchanged according to default, the 1st corresponding memory cell of random value and N are stored
Random number in unit is exchanged, i.e., the random number in the 1st corresponding memory cell of random value is stored in into N storages
In unit, and the random number in N memory cell is stored in the 1st corresponding memory cell of random value.When i is 2
When, the 2nd random value is generated according to current time and the 1st random value, and generated according to the 2nd random value and treat that exchange is deposited
The ident value of storage unit, exchanges rule, the 2nd corresponding memory cell of random value and N-1 memory cell according to default
In random number exchanged, i.e., it is single the random number in the 2nd corresponding memory cell of random value to be stored in into N-1 storages
In member, and the random number in N-1 memory cell is stored in the 2nd corresponding memory cell of random value.Circulated with this,
Until the random number that all random numbers store the memory cell storage in array completes to exchange.In the above-described embodiments, by the 1st
The secondary memory cell for exchanging the ident value calculated is first exchanged with N memory cell.In the other embodiment of the application,
Exchange can also be first proceeded by from the first memory cell.
For example, a random number storage array randArry [] is initialized.Each storage list in array is stored to random number
Member uses natural number assignment.For example, randArry [0]=1, randArry [1]=2 ... randArry [n-1]=n.Circulation upsets random number
Store the position of each memory cell in array.It is for instance possible to use random number stores each storage list in array every time
Member storage value exchanged with the value that i-th of memory cell reciprocal is stored, i successively decreases from n-1, such as randArry [1]=2 and
RandArry [n-1]=n is replaced.
It should be noted that the method that the random number in memory cell is exchanged of the embodiment of the present application is default exchange
One kind of rule, you can be configured according to actual needs to default rule of exchanging, by different exchange methods to storage
Random number in unit is exchanged.
S330, judges whether the memory cell in random number storage array was all exchanged.
S340, if random number storage array in memory cell be all exchanged, it is determined that stored in memory cell with
The order completely random of machine number, therefore, random number storage array are available.
Specifically, determine that the random number stored in random number storage array in N number of memory cell is all exchanged,
The ident value that instruction obtains the current memory cell being read is obtained according to random number;According to the storage list being currently read
The ident value of member reads the random number of next memory cell storage.
It should be noted that corresponding random number can be read from random number storage array using other modes, it is not limited to
The embodiment of the present application sequentially from random number storage array in be successively read corresponding random number.
The generation method of the random number of the embodiment of the present application, is firstly generated including N number of memory cell and the storage of each memory cell
The random number storage array of one random number, the memory cell then stored to random number in array carries out random mixing, so that
Can be when receiving random number acquisition instruction, reading memory cell is deposited in corresponding memory cell from random number storage array
The random number of storage.Due to having carried out random mixing to memory cell in random number storage array, it is achieved thereby that shorter
The random number repetitive rate repeatedly obtained in unit interval is low, and distributing equilibrium, therefore the random digit generation method of the application has
Preferable randomness.
Corresponding with the random digit generation method that above-described embodiment is provided, a kind of embodiment of the invention also provides a kind of random number
Generating means, the generating random number provided due to generating random number device provided in an embodiment of the present invention with above-mentioned several embodiments
Method has same or analogous technical characteristic, therefore is also applied for this implementation in the embodiment of foregoing random digit generation method
The generating random number device that example is provided, is not described in detail in the present embodiment.As shown in figure 4, the generation dress of the random number
Putting may include:Generation module 110, random mixing module 120, read module 130.
Wherein, generation module 110 is used to generate random number storage array, wherein, random number storage array includes N number of storage
Unit, each memory cell stores a random number, wherein, N is positive integer.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
The memory cell that random mixing module 120 is used to store random number in array carries out random mixing.
Read module 130 is used to receive random number acquisition instruction, and obtains instruction from random number stores array according to random number
The random number of memory cell storage is read in corresponding memory cell.
In one embodiment of the application, Fig. 5 is the knot of the generating means of the random number according to the application another embodiment
Structure schematic diagram, i.e., on the basis of as shown in Figure 4, as shown in figure 5, random mixing module 120 specifically includes ident value life
Into submodule 1201 and exchange submodule 1202.Specifically, in one embodiment of the application, ident value generation submodule
Block 1201 is used to generate random value according to random function, and generates according to random value the ident value of memory cell to be exchanged.Exchange
Submodule 1202 be used for according to ident value and it is default exchange it is regular by memory cell to be exchanged with it is random in Destination Storage Unit
Number is exchanged.
In one embodiment of the application, when i is more than 1 and is less than N, ident value generates submodule 1201 according to current
Time and the i-th -1 time random value generation ith random value, wherein, i is exchange number of times.When i is equal to 1, ident value generation
Submodule 1201 generates ith random value according to current time.
In one embodiment of the application, default rule of exchanging is:When carrying out ith exchange, by ith random value pair
The memory cell answered is exchanged with the random number in (N+1-i) memory cell.
In one embodiment of the application, receive random number and obtain after instruction, whether judge current memory cell is random
Last of number storage array, last memory cell in array is stored if not random number, then is continued under reading
The random number of one memory cell storage.If last memory cell in random number storage array, then need again
The new random number storage array of generation.
In one embodiment of the application, Fig. 6 is the knot of the generating means of the random number according to the application another embodiment
Structure schematic diagram, on the basis of as shown in Figure 4, read module 130 is specifically included:Acquisition submodule 1301 and reading submodule
Block 1302.
Specifically, acquisition submodule 1301 is used to obtain the mark that instruction obtains the current memory cell being read according to random number
Knowledge value.Reading submodule 1302 is used to be deposited according to the next memory cell of ident value reading of the current memory cell being read
The random number of storage.
The generating random number device of the embodiment of the present application, firstly generating module generation includes N number of memory cell and each storage list
The random number storage array of member one random number of storage, then random mixing module is to the memory cell in random number storage array
Random mixing is carried out, so that read module can be right from random number storage array when receiving random number acquisition instruction
The random number of memory cell storage is read in the memory cell answered.Because random mixing module stores depositing in array to random number
Storage unit has carried out random mixing, it is achieved thereby that the random number repetitive rate repeatedly obtained within the shorter unit interval is low, and
Distributing equilibrium.Therefore the generating random number device of the application has preferable randomness.
Fig. 7 is the flow chart of the acquisition methods of the random number according to the application one embodiment, shown in the embodiment of the present application with
The acquisition methods of machine number are described in terms of acquisition.As shown in fig. 7, the acquisition methods of the random number comprise the following steps.
S710, receives random number and obtains instruction, and obtains random number storage array, wherein, random number storage array includes N
Individual memory cell, each memory cell stores the position of N number of memory cell in a random number, and random number storage array
Determined by random mixing, wherein, N is positive integer.
In embodiments herein, the random number stored in N number of memory cell is differed.
In embodiments herein, N number of memory cell can store 1 respectively to N number of integer, so that each memory cell
The random number of storage is different from others.
In another embodiment of the application, the length of random number storage array can be configured, as needed to random
The length of number storage array is configured in advance.
In embodiments herein, after generation random number storage array, each memory cell has ident value, according to random
Function generates random value, and generates the ident value of memory cell to be exchanged according to random value, so that it is determined that needing the storage exchanged
Unit.
, will memory cell be exchanged and Destination Storage Unit according to ident value and default exchange rule in embodiments herein
In random number exchanged.
It should be noted that the method that the random number in memory cell is exchanged of the embodiment of the present application is default exchange
One kind of rule, you can be configured according to actual needs to default rule of exchanging, by different exchange methods to storage
Random number in unit is exchanged.
S720, instruction acquisition memory cell storage in corresponding memory cell from random number storage array is obtained according to random number
Random number.
Specifically, in the specific embodiment of the application, after random number acquisition instruction is received, according to random number
The ident value (ident value of the i.e. last memory cell being read) that instruction obtains the current memory cell being read is obtained,
The random number that next memory cell is stored is read according to the ident value for the memory cell being currently read.
The random number acquisition methods of the embodiment of the present application, are firstly received random number and obtain instruction, then obtain random number storage
Array simultaneously determines that random number stores the position of N number of memory cell in array by random mixing, so that random according to receiving
Number obtains memory cell storage is read in instruction from random number storage array random number in corresponding memory cell.Due to
Random mixing has been carried out to memory cell in machine number storage array, it is achieved thereby that repeatedly obtained within the shorter unit interval
Random number repetitive rate is low, and distributing equilibrium.Therefore the random number acquisition methods of the application have preferable randomness.
Corresponding with the random number acquisition methods that above-described embodiment is provided, a kind of embodiment of the invention also provides a kind of random number
Acquisition device, because the random number that random number acquisition device provided in an embodiment of the present invention is provided with above-mentioned several embodiments is obtained
Method has same or analogous technical characteristic, therefore is also applied for this implementation in the embodiment of foregoing random number acquisition methods
The random number acquisition device that example is provided, is not described in detail in the present embodiment.As shown in figure 8, the acquisition dress of the random number
Putting may include:Receiving module 210, random number storage array acquisition module 220, random number acquisition module 230.
Wherein, receiving module 210 is used to receive random number acquisition instruction.
Random number storage array acquisition module 220 is used to obtain random number storage array, wherein, random number storage array includes
N number of memory cell, each memory cell stores the position of N number of memory cell in a random number, and random number storage array
Put and determined by random mixing, wherein, N is positive integer.
In one embodiment of the application, the random number stored in N number of memory cell is differed.
Random number acquisition module 230, which is used to be obtained according to random number, to be instructed from random number storage array in corresponding memory cell
Obtain the random number of memory cell storage.
In one embodiment of the application, Fig. 9 is the knot of the acquisition device of the random number according to the application another embodiment
Structure schematic diagram, i.e., on the basis of as shown in Figure 8, obtain as shown in figure 9, random number acquisition module 230 specifically includes first
Submodule 2301 is taken to be used to obtain the ident value that instruction obtains the current memory cell being read according to random number.Second obtains
Submodule 2302 is used to obtain the random of next memory cell storage according to the ident value of the current memory cell being read
Number.
The random number acquisition device of the embodiment of the present application, first receiving module receive random number and obtain instruction, then random number
Storage array acquisition module obtains random number storage array and determines that random number stores N number of storage in array by random mixing
The position of unit, thus random number acquisition module according to receive random number obtain instruction from random number store array in it is corresponding
The random number of memory cell storage is read in memory cell.Due to having been carried out at random to memory cell in random number storage array
Mixing, it is achieved thereby that the random number repetitive rate repeatedly obtained within the shorter unit interval is low, and distributing equilibrium.Therefore originally
The random number acquisition device of application has preferable randomness.
In the description of the present application, it is to be understood that term " first ", " second " are only used for describing purpose, and can not
It is interpreted as indicating or implies relative importance or the implicit quantity for indicating indicated technical characteristic.Thus, define " the
One ", at least one this feature can be expressed or be implicitly included to the feature of " second ".In the description of the present application, " multiple "
It is meant that at least two, such as two, three etc., unless otherwise specifically defined.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specific example ",
Or the description of " some examples " etc. means to combine specific features, structure, material or the feature that the embodiment or example are described
It is contained at least one embodiment of the application or example.In this manual, need not to the schematic representation of above-mentioned term
Identical embodiment or example must be directed to.Moreover, specific features, structure, material or the feature of description can be with office
Combined in an appropriate manner in one or more embodiments or example.In addition, in the case of not conflicting, this area
Technical staff can be tied the not be the same as Example or the feature of example and non-be the same as Example or example described in this specification
Close and combine.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes one
Or more be used for executable instruction the step of realize specific logical function or process code module, fragment or part,
And the scope of the preferred embodiment of the application includes other realization, wherein order that is shown or discussing can not be pressed,
Including according to involved function by it is basic simultaneously in the way of or in the opposite order, carry out perform function, this should be by the application's
Embodiment person of ordinary skill in the field is understood.
It should be appreciated that each several part of the application can be realized with hardware, software, firmware or combinations thereof.In above-mentioned reality
Apply in mode, software that multiple steps or method can be performed in memory and by suitable instruction execution system with storage or
Firmware is realized.If, and in another embodiment, can be with well known in the art for example, realized with hardware
Any one of row technology or their combination are realized:With the logic gates for realizing logic function to data-signal
Discrete logic, the application specific integrated circuit with suitable combinational logic gate circuit, programmable gate array (PGA) is existing
Field programmable gate array (FPGA) etc..
Those skilled in the art be appreciated that to realize all or part of step that above-described embodiment method is carried is can
To instruct the hardware of correlation to complete by program, described program can be stored in a kind of computer-readable recording medium,
The program upon execution, including one or a combination set of the step of embodiment of the method.
In addition, each functional unit in the application each embodiment can be integrated in a processing module or each
Individual unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated module was both
It can be realized in the form of hardware, it would however also be possible to employ the form of software function module is realized.If the integrated module with
The form of software function module realize and as independent production marketing or in use, can also be stored in one it is computer-readable
Take in storage medium.
Storage medium mentioned above can be read-only storage, disk or CD etc..Although having been shown and described above
Embodiments herein, it is to be understood that above-described embodiment is exemplary, it is impossible to be interpreted as the limitation to the application,
One of ordinary skill in the art can be changed to above-described embodiment, change, replacing and modification within the scope of application.