In some situations, setting the seed alone will not guaranteethe same results. This is because the generator that the random numberfunctions draw from might be different than you expect when your codeexecutes. For long-term repeatability, specify the seed and the generatortype together.
Matlab R2010a Serial Number Generator
Download File: https://gohhs.com/2vEmnc
When you perform parallel processing, do not use rng('shuffle') to set the random number stream on different workers to ensure independent streams since it seeds the random number generator based on the current time. This is especially true when the command is sent to multiple workers simultaneously, such as inside a parfor job. For independent streams on the workers, use the default behavior or consider using a unique substream on each worker using RandStream.
When you perform parallel processing, the default random number generators on the MATLAB client and MATLAB workers are different. If you need to generate the same random stream of numbers on the client and workers, you can use rng with the same generator type and seed (or consider using RandStream with the same generator type, seed, and normal transformation algorithm). For more information, see Control Random Number Streams on Workers (Parallel Computing Toolbox).
If extrinsic calls are enabled and rng is not called from inside a parfor loop, generated MEX files use the same random number state as MATLAB in serial code. Otherwise, the generated MEX code and standalone code maintain their own random number state that is initialized to the same state as MATLAB.
Random number generator algorithm, specified as a character vector or string scalar naming a random number generator. MATLAB offers several generator algorithms. The following table summarizes the names and key properties of the available generator algorithms. Some generator algorithms support multiple streams and substreams to create sets of random numbers that are mutually independent. For more information, see Creating and Controlling a Random Number Stream.
Specify the generator seed as an initialization step when creating a stream at MATLAB startup or before running a simulation. To reproduce a stream, use the same seed every time. While using multiple seeds will create multiple sequences of random numbers, there is no guarantee that the different sequences are statistically independent. In situations where this is important, specify the Substream property or use RandStream.create to create streams that are statistically independent.
Current internal state of the generator, specified as a vector of integers. The size of the state vector depends on the generator algorithm. When you set this property, the value you assign to s.State must be a value read from s.State previously. Use reset to return a stream to its initial state without having previously read from the State property. Saving and restoring the internal state of the generator with the State property allows you to reproduce a sequence of random numbers.
The internal state determines the sequence of random numbers produced by the random number stream s. Every time you generate random numbers from a single stream, the state of the generator in the stream is transformed to create successive values that are statistically independent and identically distributed.
Generate five random numbers from the stream. Every time you generate a number from the stream, the generator algorithm transforms the internal state such that the next generated number is independent and identically distributed from the previous number.
MATLAB has had random numbers since the beginning. But not surprisingly, as the state of that art advanced, the originaltools in MATLAB were not really suitable to incorporate new ideas like parallel random number generation. So R2008b saw theaddition of the RandStream class, which was designed to support those new ideas, including new generator algorithms, multiple random number streams,substreams, and parallel generation.
RandStream also fixed an old problem that most people didn't even know existed, where MATLAB code that reseeded or read/wrote the state of MATLAB's random numbergenerator using the pre-R2008b "control" syntaxes, such as
Definitely a simpler syntax, and yet there's still some potentially tricky ideas going on there, ideas that can trip you up.A couple of years ago, I wrote two posts describing the basic ideas behind random number generator seeds and states, and showed how to "control" the generator inMATLAB, and more importantly, discussed when and when not to. All of that is still relevant and important to understand. But those posts explain it terms of RandStream.
The paper deals with true random number generators employing oscillatorrings, namely, with the one proposed by Sunar et al.in 2007 and enhanced by Wold and Tan in 2009. Our mathematical analysisshows that both architectures behave identically whencomposed of the same number of rings and ideal logic components. However, the reduction of the number of rings, as proposedby Wold and Tan, would inevitably cause the loss of entropy. Unfortunately, this entropy insufficiency is maskedby the pseudo-randomness caused by XOR-ing clock signals having differentfrequencies. Our simulation model shows that thegenerator, using more than 18 ideal jitter-free rings having slightlydifferent frequencies and producing only pseudo-randomness,will let the statistical tests pass. We conclude that a smallernumber of rings reduce the security if the entropy reduction isnot taken into account in post-processing. Moreover, the designer cannotavoid that some of rings will have the same frequency,which will cause another loss of entropy. In order to confirm this, weshow how the attacker can reach a state where over25% of the rings are locked and thus completely dependent. This effectcan have disastrous consequences on the system security.
The quality of the generated bit-streams is evaluated using dedicated statistical tests such as FIPS 140-2 [1], NIST 800-22 [2], and Diehard [3]. However, the statistical tests are not able to give a mathematical proof that the generator generates true random numbers and not only pseudo-random numbers that can be employed in attacks [4]. For this reason, Killmann and Schindler [5] propose to characterize the source of randomness from the raw binary signal in order to estimate the entropy in the generator output bit-stream.
It is commonly accepted that contrary to the original design of Sunar et al., the modified architecture proposed by Wold and Tan maintains the entropy of the raw binary signal after the XOR gate if the number of rings is unchanged. However, we believe that several other questions are worthy of investigation. The aim of our paper is to find answers to the following questions and to discuss related problems: (i)Is the security proof of Sunar valid also for the generator of Wold and Tan? (ii)What is the entropy of the generated bitstream after the reduction of number of rings? (iii)How does security enhancement proposed by Fischer et al. in [17] modify the quality of the generated binary raw signal? (iv)How should the relationship between the rings be taken into account in entropy estimation?
The principle of our simulation platform and experimental platform is depicted in Figure 2. For both platforms, the two generators were described in VHDL language and their architectures differed only in the use of flip-flops on the rings outputs (dashed blocks in Figure 2). The bitstreams obtained at the output of the final sampling flip-flop (before the post-processing) were tested and evaluated for different types and sizes of jitter in simulations and for different numbers of ring oscillators in both simulations and hardware experiments. The output of the TRNG was written into a binary file that was used as an input file in statistical tests.
We applied the FIPS 140-2 tests on the raw binary signals generated by the two generators, while incrementing the number of ROs. The results obtained for Actel FPGA are presented in Figure 5 and those obtained for Altera FPGA in Figure 6. The number of ROs varied from 1 to 20 by increments of 1 and from 20 to 115 by increments of 5.
Nevertheless, even the new architecture does not eliminate serious doubts about the entropy contents in the raw signal. Unfortunately, this entropy cannot be measured. Applying the theory of Sunar et al., the entropy of the raw binary signal can be estimated knowing the sampling frequency, size of the jitter, and number of independent rings. Supposing that the rings are independent, this theory remains valid for the new generator architecture as we showed in Section 2. For this reason, we can conclude that while reducing number of rings, Wold and Tan reduced unconsciously the entropy of the generated signal. In order to maintain the security level, they should also modify the resilient function, in order to increase the compression ratio and to guarantee the output entropy per bit close to one. Instead, they propose to remove the post-processing, which is clearly a very dangerous action from the point of view of security.
For example, by modulating the power supply and thus changing the periods ??, the attacker can control the pseudo-random behavior of the generator to some extent (mutual relations between clock periods) and the state can be reached where the rings are locked. This way, the effective number of usable (independent) rings is reduced. As in the case of the generator of Wold and Tan, the reduced number of rings will lower the entropy of the generated signal and at the same time the generator's pseudo-random behavior will be simpler and thus easier to guess.
As it was shown, the generator of Wold and Tan follows the same mathematical model as that of Sunar et al. The security proof of Sunar can thus be applied (theoretically) also in this case. Because the generator of Wold and Tan gives much better binary raw signal in hardware, it should be preferred. However, in order to assure that the proof of Sunar will hold, the number of rings should not be reduced as proposed in [18] only because the tests passed. As we showed, the generator using more than 18 ideal jitter-free rings having slightly different frequencies and producing only the manipulable pseudo-randomness will always let the tests pass. 2ff7e9595c
Comments