Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Extremely biased distribution from v2 device #1000

    piersona
    Member

    I’ve learned two things:
    1. A chi squared result that “would exceed this value N percent of the times.” is not a failure for N != 50.00. See http://www.fourmilab.ch/random/

    2. The values I’m seeing for N are never as arbitrary as that website would lead me to believe, e.g. “40.98″. Instead, I’m seeing values of 25.00, 50.00, 75.00, 90.00, and 95.00.

    Even for the 95.00% case, the data examined with “ent -c” looks well distributed. I think they are performing well; it’s just my misunderstanding.

    in reply to: Extremely biased distribution from v2 device #996

    piersona
    Member

    I just got mine and saw the same thing:

    0|14:35 ~/truerng$ dd if=/dev/ttyACM1 of=data.2.bin bs=1024 count=$((2**20)) iflag=fullblock
    ^C97419+0 records in
    97419+0 records out
    99757056 bytes (100 MB) copied, 2228.41 s, 44.8 kB/s
    
    130|15:13 ~/truerng$ ent data.2.bin
    Entropy = 7.999998 bits per byte.
    
    Optimum compression would reduce the size
    of this 99757056 byte file by 0 percent.
    
    Chi square distribution for 99757056 samples is 270.00, and randomly
    would exceed this value 25.00 percent of the times.
    
    Arithmetic mean value of data bytes is 127.5062 (127.5 = random).
    Monte Carlo value for Pi is 3.141212507 (error 0.01 percent).
    Serial correlation coefficient is 0.000179 (totally uncorrelated = 0.0).

    I did not get the same problem when I repeated with a smaller experiment without fullblock:

    0|15:13 ~/truerng$ dd if=/dev/ttyACM1 of=data.2.bin bs=1024 count=$((2**15))
    dd: warning: partial read (469 bytes); suggest iflag=fullblock
    3+32765 records in
    3+32765 records out
    2068055 bytes (2.1 MB) copied, 45.1346 s, 45.8 kB/s
    0|15:15 ~/truerng$ ent data.2.bin
    Entropy = 7.999914 bits per byte.
    
    Optimum compression would reduce the size
    of this 2068055 byte file by 0 percent.
    
    Chi square distribution for 2068055 samples is 246.19, and randomly
    would exceed this value 50.00 percent of the times.
    
    Arithmetic mean value of data bytes is 127.5313 (127.5 = random).
    Monte Carlo value for Pi is 3.140837020 (error 0.02 percent).
    Serial correlation coefficient is -0.001316 (totally uncorrelated = 0.0).

    I’m running two devices simultaneously, as the previous poster was, as well. /dev/ttyACM1 is the misbehaving unit. I’m currently running the following test script and will update once it’s finished:

    #!/bin/bash
    
    if test "${1}" == ""
    then
        echo "You must specify the device"
        exit 1
    fi
    
    device=/dev/ttyACM${1}
    logfile=test.${1}.log
    
    for i in 1 2 3 4 5 6 7 8 9 0
    do
        for bs in 3 4 5 6 7 8 9 10
        do
            bbs=$((2**${bs}))
            bcount=$((2**(24-${bs})))
            echo '==========================='                                            >> ${logfile} 2>&1
            filename=test.${1}.bs$((2**${bs})).fb0.${i}.bin
            echo ${filename}                                                              >> ${logfile} 2>&1
            time dd if=${device} of=${filename} bs=${bbs} count=${bcount}                 >> ${logfile} 2>&1
            ent ${filename}                                                               >> ${logfile} 2>&1
    
            filename=test.${1}.bs$((2**${bs})).fb1.${i}.bin
            echo ${filename}                                                              >> ${logfile} 2>&1
            time dd if=${device} of=${filename} bs=${bbs} count=${bcount} iflag=fullblock >> ${logfile} 2>&1
            ent ${filename}                                                               >> ${logfile} 2>&1
        done
    done
    

    Additionally, I was playing with the rngd in the background, so potentially running that at the same time could have been causing problems. I’ll run a second test with that running once this finishes.

    –Andrew

    • This reply was modified 9 years, 4 months ago by  piersona.
    • This reply was modified 9 years, 4 months ago by  piersona.
    • This reply was modified 9 years, 4 months ago by  piersona.
Viewing 2 posts - 1 through 2 (of 2 total)