Prev: how to run a GUI in simulink
Next: IEEE ARTICLE
From: mathew on 26 Mar 2010 23:26 I need advice on how to write a binary file suitable for testing by Diehard suite. My RNG (whose output is a string of 0s and 1s) is implemented using Matlab. How should the 0s and 1s be written in the binary file - as a 32bit integer or in a different way?
From: Ulf Graewe on 27 Mar 2010 06:00 "mathew(a)upb" <mathewgeorge100(a)hotmail.com> wrote in message <922970972.452981.1269674807635.JavaMail.root(a)gallium.mathforum.org>... > I need advice on how to write a binary file suitable for testing by Diehard suite. My RNG (whose output is a string of 0s and 1s) is implemented using Matlab. How should the 0s and 1s be written in the binary file - as a 32bit integer or in a different way? As far as I can remember, the Diehard test needs 32bit integers for testing. To be sure, have a look into the source code of the test suite. The test suite I used, contained also a subroutine for generating random streams of different generators for testing. Maybe this will help you.
From: mathew on 28 Mar 2010 06:45 Thank you for the response. I am novice in Matlab programming and Diehard testing. As far as I know, the input of (old) Diehard need to be a bin file with 32bit integers. So far I am unsuccessful in creating a bin file from Matlab, which passed Diehard testing. One of the reasons for the failure could be the RN sequence itself and to avoid this ambiguity, I am using a sequence generated by MT19937 RNG, as I read somewhere that sequences from MT RNG, passes DH tests. Have you created a bin file, which passed DH tests, using Matlab? If yes, could you post the commands used to write the bin file?
From: mathew on 28 Mar 2010 06:49 One of the requirements of the bin file for DH testing, as notified by the program is as follows - *** Enter the name of the file to be tested. This must be a form="unformatted",access="direct" binary file of about 10-12 million bytes. Enter file name: ***
From: Jan Simon on 28 Mar 2010 11:42
Dear Mathew! > I need advice on how to write a binary file suitable for testing by Diehard suite. My RNG (whose output is a string of 0s and 1s) is implemented using Matlab. How should the 0s and 1s be written in the binary file - as a 32bit integer or in a different way? You have a string of '1' and '0', e.g. '10010100101010101101111011'. You want a binary file, which consists of 32 bit integers. So at first you have to cut the string to a multiple of 32 characters. Then reshape the array to get 8 bit (character!) parts. Finally convert them to decimal numbers and write them as UINT8 variables: Pool = '01'; S = Pool((rand(1, 1e6) > 0.5) + 1); % Test data S = S(1:length(S) - mod(length(S), 32)); S = double(reshape(S, 8, [])); V = 2 .^ (0:7) * S; FID = fopen(FileName, 'wb'); fwrite(FID, V, 'uint8'); fclose(FID); Now the file contains the bits in the same order as your string: '1001010010...' ==> 1001010010... It does not matter at all, if these bits are interpreted as 1, 8, 16, 32 or 64 bit integers, if they are examined by the DIEHARD test! This test checks the correlation between bit sequences - if the 8bit block are correlated, the 32bit blocks are also. Good luck, Jan |