Patent ID: 6990201

Claim:
A method for testing a random number generator in an electronic device, comprising the following steps: Step one: Generation of a sequence of (Q+K)*L bits by the random number generator, with Q, K and L being input parameters, the bits in the sequence being grouped in blocks of L bits, forming a sequence of integers between 0 and 2 L −1 of length Q+K, the length being stored in a table block[n], where n is between 1 and Q+K; Step two: Calculating a test parameter, denoted fTU according to the following substeps 2.1 to 2.5: 2.1 Creation and initialisation of a table tab[i] of size 2 L 2.2 For n vrying from 1 to Q, making the calculation: tab [block [n]]=n; 2.3 Initialising a number of Sum to 0; 2.4 For n varying from Q+1 to Q+K, performing the calcualtion in two operations: Add log( n −tab[block[ n ]] to Sum; Make the calculation: tab[block[ n]]=n; 2.5 Setting the parameter fTU of the test to be fTU=(Sum/K)/Log(2); Step three: Calculation of the variance, denoted Var, from the following expression: Var = ( 1 - z ) * ∑ i = 1 ∞ ⁢ log ⁢ ⁢ 2 ⁢ ( i ) 2 * z i - 1 - ( ( 1 - z ) * ∑ i = 1 ∞ ⁢ log ⁢ ⁢ 2 ⁢ ( i ) * z i - 1 ) 2 with log2(z)=log(z)/log(2) and z=1−2 −L Step four: Calculation of a function c(L,K); Step five: Calculation of the standard deviation of the test parameter, denoted σ: σ=c(L.K)*√(Var/K); Step six: Calculation of the parameter y; where y is determined from the rejection rate of the test fixed as an input, denoted ρ, and satisfies the equation: N (− y )=ρ where N is the normal density function; Step seven: Calculation of the ideal mean value of the test, denoted E[fTU], given by the following formula: E ⁡ [ fTU ] = ( 1 - z ) * ∑ i = 1 ∞ ⁢ log ⁢ ⁢ 2 ⁢ ( i ) * z i - 1 Step eight: Calculation of the bounds t1 and t2, where t1=E[fTU]−y*σ and t2=E[fTU]+y*σ; and Step nine: Accepting the random number generator if the test parameter fTU is between t1 and t2, and rejecting the random number generator in the contrary case, wherein step four comprises a calculation of the function c(L,K) which is valid whatever the parameters L and K.