Random/LFSR on P2

1151617181921»

Comments

  • evanhevanh Posts: 3,973
    edited May 8 Vote Up0Vote Down
    I've done a little code tidy up and it now sorts the score table by combination order. Here's the s16 scores again, I've also run the "Byte1" scoring now too:
    
        Xorshift32+ PractRand Score Table
    
    Combination   Word  Byte3  Byte2  Byte1   Bit
    ===============================================
     [ 1  1  7]     2M   128K     4M     8M     4K
     [ 1  1 12]     1M    64K   256K   512K     4K
     [ 1  1 13]   512K    64K   256K   256K     4K
     [ 2  5  8]     8M   256K    32M   128M   256K
     [ 2  5 13]     8M   256K    16M     8M   256K
     [ 2 13 15]     1M   128K   256K   256K   256K
     [ 2 15 13]     1M   128K   256K   256K   256K
     [ 3  7  6]     8M   256K     4M    16M    32M
     [ 5  3  1]   512M     8M   128M    16M     1G
     [ 5  3  8]   128M     2M   512M   128M     1G
     [ 5  3 13]   128M     2M   128M    64M     1G
     [ 5  7  4]    64M     2M    64M    16M    32M
     [ 6  3  8]   256M     8M   512M   128M     1G
     [ 7  1  6]   128M    16M    32M     8M    64M
     [ 7  1 15]     2M     8M     1M    32K   128M
     [ 7  2  1]    64M    32M    32M     1M     1G
     [ 8  3  9]   128M     1G   128M   128M   256M
     [ 9 14  5]    16M    16M     8M     1M   256M
     [11  8  5]    32M     4M   256M   128M     1G
     [13 12  3]     4M   512K   512K     4M   512M
     [14  1 15]   256K    64K    32K    32K     4K
     [15 10  1]   256K    32K    32K     1M   512M
    
    
        Xoroshiro32+ PractRand Score Table
    
    Combination   Word  Byte3  Byte2  Byte1   Bit
    ===============================================
     [ 1  2  8]    32M    16M    64M    32M     1G
     [ 2  1 11]     8M   128K   128K   256K     1G
     [ 2  1 15]   128K    32K    32K    32K     1G
     [ 2  2  7]     8M    32M    32M     4M     1G
     [ 2  6 15]     2M    16M   128K   128K     1G
     [ 2  8  7]     8M   128M    32M     4M     1G
     [ 2  9  9]   256K    16K   128K    64M     1G
     [ 2 11  3]     2M   512K   256K   256K     1G
     [ 3  2  6]    64M     2M     2M     1M     1G
     [ 3  3 10]    16M   256K   256K    64M     1G
     [ 3 11  2]   256K   128K    64K    64K     1G
     [ 3 11 14]     4M   256K   256K   512K     1G
     [ 4  1  9]   512K   512K     8M   512K   512M
     [ 4  7 15]    64M   128M   512K   512K     1G
     [ 4  8  5]   512M    32M     8M     2M     1G
     [ 5  2  6]   128M     8M     4M     4M     1G
     [ 5  8  4]     4M     4M     1M   128K    64M
     [ 5 14 12]   128M     2M     4M   128M     1G
     [ 6  2  3]    32M     1M     1M     2M     2M
     [ 6  2  5]    16M   256K   512K   512K     4M
     [ 6  2 11]   512M     8M     8M   128M     1G
     [ 6  3 15]    32M     1M     1M     4M     1G
     [ 6 14 11]   128M    32M    64M    16M     1G
     [ 7  1  8]    64M    16M   128M    16M     1G
     [ 7  2  2]    16M     2M     2M     4M     4M
     [ 7  2 10]     1G   128M   256M    32M     1G
     [ 7  2 14]   512M     4M     8M    32M   256M
     [ 7  8  2]   512M    64M     8M     4M   512M
     [ 7 10 10]   128M    32M    32M   128M     1G
     [ 7 15  8]     2M   256K     1M   256K     1G
     [ 8  1  7]     1M     1M     1M     1M    64M
     [ 8  2  1]    32M     8M     8M    16M    16M
     [ 8  5 13]    32M    16M     8M   128M     1G
     [ 8  7 15]     2M   512K     2M     1M     1G
     [ 8  9 13]   512M   512M     1G   128M     1G
     [ 8 15  7]   512K   256K   512K   256K     1G
     [ 9  1  4]    32M     8M    16M    16M    64M
     [ 9  2 14]     2G   128M   256M   128M     1G
     [ 9  8 14]    16M   256M    32M    64M     1G
     [ 9  9  2]    32M    16M    16M    32M    64M
     [10  2  7]   256M    16M    16M    32M     1G
     [10  3  3]    64M    32M    32M    64M   256M
     [10  3 11]     2G   256M   256M   128M     1G
     [10  5 13]     2G     1G   512M   128M   512M
     [10  7 11]   512M   512M   128M   128M     1G
     [10 10  7]    16M    16M    16M   128M   512M
     [11  1  2]   256M    32M    32M    32M     1G
     [11  1 14]     1G    32M    16M    16M     1G
     [11  2  6]   512M    32M    64M   128M   512M
     [11  3 10]    32M    64M     1M    64K   128M
     [11  7 10]     4M    32M   128K    64K     1G
     [11  8 12]   256M   512M   512M   128M     1G
     [11 10 12]   128M     1G   512M   128M     1G
     [11 11 14]    64M    16M    16M     8M     1G
     [11 14  6]   256M   256M    64M   128M     1G
     [12  4 15]   512M   128M    64M    16M     1G
     [12  8 11]     4M    64M   128K    64K     1G
     [12 10 11]     2M   128K   128K    64K     1G
     [12 10 13]    32M    16M    16M     8M     1G
     [12 14  5]    32M   128M   128M    64M     1G
     [13  3 14]   512M    64M    32M     8M     1G
     [13  5  8]   256M   512M   128M   128M     1G
     [13  5 10]    64M    64M    16M   256K     1G
     [13  9  8]   128M   512M   512M   128M     1G
     [13 10 12]     2M   128K   128K    64K   512M
     [13 11 14]    16M     8M     8M     8M     1G
     [13 12 14]    16M     8M     8M     4M     1G
     [13 13 14]    16M     8M     8M     8M     1G
     [14  1 11]    64M   256K   256K   256K     1G
     [14  2  7]     1G     1G   512M   128M     1G
     [14  2  9]   512M   128M   128M   128M     1G
     [14  3 13]    16M     1M   256K    64K     1G
     [14  8  9]   128M     1G    64M    64M     1G
     [14 11  3]   512M   256M   128M    64M     1G
     [14 11 11]    16M   256K   256K   256K     1G
     [14 11 13]   512K   128K    64K    64K     1G
     [14 12 13]   512K   128K    64K    64K     1G
     [14 13 13]   128K    64K    64K    64K   256M
     [15  1  2]     2M     1M   512K   256K     1G
     [15  3  6]     1G   512M   512M   128M     1G
     [15  4 12]   128M   128M     8M   256K     1G
     [15  6  2]   128M   128M   128M    16M     1G
     [15  7  4]   512M   512M   512M   128M     1G
     [15  7  8]    64M    32M    32M     2M   512M
    
    EDIT: Oops, I had left some scoring variants disabled. I've removed the attached sources here.
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    edited May 8 Vote Up0Vote Down
    Ramon,
    Check out me "extract_score" Bash function. I'm a little proud of that one. Lots of googling involved to get it right.

    I still don't really know any of the meanings of the various bracketing mechanisms [], [[]], (), (()), {} ... about the only one I'm confident in using is "" and '', and even then I'm not sure if there is any distinction between single and double quotes.

    EDIT: Corrected spelling of Ramon's name.
    $50,000 buys you a discrediting of a journalist
  • cgraceycgracey Posts: 7,750
    edited May 8 Vote Up0Vote Down
    I just noticed something. The higher up the adder chain, the better the random quality gets. Bytes, even a bit, extracted from the top is better quality than data extracted from lower bits.
  • evanhevanh Posts: 3,973
    Yeah, that was the reason I was historically sometimes trimming the search range to improve completion times but I've decided that's too early to be blindly eliminating candidates.

    Here's the current sources again but with all scoring variants enabled now:
    $50,000 buys you a discrediting of a journalist
  • Wow! Evanh, you are The Shell Ninja.

    I had to search what the ^^ was doing there. Also the same for shopt.

    I prefer not to employ commands that depend on some version of bash. That uppercase (^^) needs at least bash version 4.0. They can also be done with 'tr' or 'awk'. It will be much slower but maybe is more portable.
    $ echo "4 kilobytes" | tr '[a-z]' '[A-Z]'
    4 Kilobytes
    
    $ echo "4 kilobytes" | tr '[:lower:]' '[:upper:]'
    4 KILOBYTES
    
    $ grep 'length=' test-s9/PRscore-xs-s9bit-a1b2c6.out | tail -n1 | awk '{ printf "%3s%1s", $2, toupper(substr($3,0,1)) }'
    

    Also the readline can be reordered to the first command and grep can be put inside a '<( )'to avoid the pipe (and shopt).
    $ read length value suffix line < <(grep 'length=' test-s9/PRscore-xs-s9bit-a1b2c6.out | tail -1)
    

    Or much better ... you can directly modify PractRand source code to output your desired printf format. (but maybe it's not as funny as shell scripting) :
    $ diff RNG_test.cpp.orig RNG_test.cpp
    455c455
    < 	const char *unitstr[6] = {"kilobyte", "megabyte", "gigabyte", "terabyte", "petabyte", "exabyte"};
    ---
    > 	const char *unitstr[6] = {"K", "M", "G", "T", "P", "E"}; // Kilobyte, Mega...
    458,460c458,459
    < 	if (length & (length-1))
    < 		std::printf("%.3f %ss", length * std::pow(0.5,units*10.0+10), unitstr[units] );
    < 	else std::printf("%.0f %s%s", length * std::pow(0.5,units*10.0+10), unitstr[units], length != (Uint64(1024)<<(units*10)) ? "s" : "" );
    ---
    > 	// std::printf("%.3f %s", length * std::pow(0.5,units*10.0+10), unitstr[units] );
    > 	std::printf("%3.0f%s", length * std::pow(0.5,units*10.0+10), unitstr[units] );
    

    Thanks for the update. The scripts worked great (for bit test) (I have just seen that you updated the scripts to enable all test). Previous version had some issue detecting the CPU load with my computer. Before I needed to comment out the section that detected CPU load, but this time they worked perfect the first time.
  • evanhevanh Posts: 3,973
    Thanks Ramon,
    I'll do both those.

    Yeah, there was a bug in the CPU load test early on. It would just keep launching a new task irrespective. I think that was another example of me not understanding the bracketing I was using.

    Chip,
    I've just finished s19 and s20 bit and byte1 scoring runs and I'm thinking it's showing weakness in the lower bits in general, not just bit 0. It's more obvious in the bigger word sizes.

    I'll do some more testing ...
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    Here's the two tables
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    edited May 11 Vote Up0Vote Down
    evanh wrote: »
    Chip,
    I've just finished s19 and s20 bit and byte1 scoring runs and I'm thinking it's showing weakness in the lower bits in general, not just bit 0. It's more obvious in the bigger word sizes.

    I'll do some more testing ...
    No, there's no real consistency. Other than "byte1" variant never showing any peaks the way the others do, any other signs aren't enough to be concerned over given how sensitive Practrand seems to be.
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    edited May 11 Vote Up0Vote Down
    another deleted file ...
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    Latest sources - using awk to help format score table.
    $50,000 buys you a discrediting of a journalist
  • evanhevanh Posts: 3,973
    edited May 12 Vote Up0Vote Down
    Here's the s16 scores again with a couple of extra variants added from the above experimental look into bit1 quality. Our chosen 14 2 7 combination holds up well again with its consistency.

    Variant Key:
    - "Word1" is the full summed word size minus the lsb, for s16 (Xorshift32+/Xoroshiro32+) that is the top 15 bits [15:1].
    - "Word2" is the full summed word size minus two lsb, for s16 that is the top 14 bits [15:2].
    - "Byte08" is the most significant 8 bits of the summed word, for s16 that is bits [15:8]. Label changes per position.
    - "Byte04" is half way down the summed word, for s16 that is bits [11:4]. Label changes per position.
    - "Byte2" is always bits [9:2] for all word sizes.
    - "Byte1" is always bits [8:1] for all word sizes.
    - "Bit" is msb.
    
        Xorshift32+ PractRand Score Table
    
    Combination    Word1   Word2  Byte08  Byte04   Byte2   Byte1    Bit
    ====================================================================
     [ 1  1  7]      2M      1M    128K      4M      8M      8M      4K
     [ 1  1 12]      1M      2M     64K    256K    512K    512K      4K
     [ 1  1 13]    512K      1M     64K    256K    256K    256K      4K
     [ 2  5  8]      8M     16M    256K     32M    512M    128M    256K
     [ 2  5 13]      8M     16M    256K     16M     32M      8M    256K
     [ 2 13 15]      1M      2M    128K    256K    256K    256K    256K
     [ 2 15 13]      1M      2M    128K    256K    256K    256K    256K
     [ 3  7  6]      8M      8M    256K      4M     32M     16M     32M
     [ 5  3  1]    512M    512M      8M    128M     32M     16M      1G
     [ 5  3  8]    128M    128M      2M    512M    512M    128M      1G
     [ 5  3 13]    128M    128M      2M    128M     64M     64M      1G
     [ 5  7  4]     64M     64M      2M     64M     64M     16M     32M
     [ 6  3  8]    256M    128M      8M    512M    512M    128M      1G
     [ 7  1  6]    128M    256M     16M     32M     32M      8M     64M
     [ 7  1 15]      2M      4M      8M      1M     32K     32K    128M
     [ 7  2  1]     64M    128M     32M     32M      8M      1M      1G
     [ 8  3  9]    128M     32M      1G    128M    512M    128M    256M
     [ 9 14  5]     16M     16M     16M      8M      4M      1M    256M
     [11  8  5]     32M     64M      4M    256M    256M    128M      1G
     [13 12  3]      4M      4M    512K    512K      2M      4M    512M
     [14  1 15]    256K    256K     64K     32K     32K     32K      4K
     [15 10  1]    256K    256K     32K     32K    128K      1M    512M
    
    
        Xoroshiro32+ PractRand Score Table
    
    Combination    Word1   Word2  Byte08  Byte04   Byte2   Byte1    Bit
    ====================================================================
     [ 1  2  8]     32M     64M     16M     64M     64M     32M      1G
     [ 2  1 11]      8M      8M    128K    128K    128K    256K      1G
     [ 2  1 15]    128K    128K     32K     32K     64K     32K      1G
     [ 2  2  7]      8M      8M     32M     32M     32M      4M      1G
     [ 2  6 15]      2M      4M     16M    128K    128K    128K      1G
     [ 2  8  7]      8M     16M    128M     32M     32M      4M      1G
     [ 2  9  9]    256K    256K     16K    128K    512K     64M      1G
     [ 2 11  3]      2M      4M    512K    256K    256K    256K      1G
     [ 3  2  6]     64M     32M      2M      2M      2M      1M      1G
     [ 3  3 10]     16M     16M    256K    256K    512K     64M      1G
     [ 3 11  2]    256K    512K    128K     64K     64K     64K      1G
     [ 3 11 14]      4M      4M    256K    256K    512K    512K      1G
     [ 4  1  9]    512K      1M    512K      8M    256K    512K    512M
     [ 4  7 15]     64M     64M    128M    512K    512K    512K      1G
     [ 4  8  5]    512M    128M     32M      8M      4M      2M      1G
     [ 5  2  6]    128M    128M      8M      4M      4M      4M      1G
     [ 5  8  4]      4M     16M      4M      1M    256K    128K     64M
     [ 5 14 12]    128M     64M      2M      4M     16M    128M      1G
     [ 6  2  3]     32M     32M      1M      1M      1M      2M      2M
     [ 6  2  5]     16M     16M    256K    512K    512K    512K      4M
     [ 6  2 11]    512M    256M      8M      8M    256M    128M      1G
     [ 6  3 15]     32M     32M      1M      1M      2M      4M      1G
     [ 6 14 11]    128M    128M     32M     64M    128M     16M      1G
     [ 7  1  8]     64M    128M     16M    128M     16M     16M      1G
     [ 7  2  2]     16M     16M      2M      2M      4M      4M      4M
     [ 7  2 10]      1G    512M    128M    256M     64M     32M      1G
     [ 7  2 14]    512M    256M      4M      8M     32M     32M    256M
     [ 7  8  2]    512M    512M     64M      8M      4M      4M    512M
     [ 7 10 10]    128M    256M     32M     32M    256M    128M      1G
     [ 7 15  8]      2M      2M    256K      1M    512K    256K      1G
     [ 8  1  7]      1M      4M      1M      1M      1M      1M     64M
     [ 8  2  1]     32M     64M      8M      8M     16M     16M     16M
     [ 8  5 13]     32M     64M     16M      8M    128M    128M      1G
     [ 8  7 15]      2M      2M    512K      2M      2M      1M      1G
     [ 8  9 13]    512M    128M    512M      1G    512M    128M      1G
     [ 8 15  7]    512K      1M    256K    512K    512K    256K      1G
     [ 9  1  4]     32M     64M      8M     16M     16M     16M     64M
     [ 9  2 14]      2G      1G    128M    256M     64M    128M      1G
     [ 9  8 14]     16M     32M    256M     32M     32M     64M      1G
     [ 9  9  2]     32M     64M     16M     16M     16M     32M     64M
     [10  2  7]    256M    128M     16M     16M     64M     32M      1G
     [10  3  3]     64M     64M     32M     32M     32M     64M    256M
     [10  3 11]      2G      1G    256M    256M    512M    128M      1G
     [10  5 13]      2G    512M      1G    512M    256M    128M    512M
     [10  7 11]    512M    128M    512M    128M    512M    128M      1G
     [10 10  7]     16M     16M     16M     16M    512M    128M    512M
     [11  1  2]    256M    256M     32M     32M     32M     32M      1G
     [11  1 14]      1G      1G     32M     16M     16M     16M      1G
     [11  2  6]    512M    512M     32M     64M    512M    128M    512M
     [11  3 10]     32M     32M     64M      1M    128K     64K    128M
     [11  7 10]      4M      8M     32M    128K    128K     64K      1G
     [11  8 12]    256M    256M    512M    512M    512M    128M      1G
     [11 10 12]    128M    128M      1G    512M    512M    128M      1G
     [11 11 14]     64M    128M     16M     16M     16M      8M      1G
     [11 14  6]    256M    128M    256M     64M    512M    128M      1G
     [12  4 15]    512M      1G    128M     64M     16M     16M      1G
     [12  8 11]      4M      4M     64M    128K    128K     64K      1G
     [12 10 11]      2M      2M    128K    128K    128K     64K      1G
     [12 10 13]     32M     64M     16M     16M     32M      8M      1G
     [12 14  5]     32M     32M    128M    128M     64M     64M      1G
     [13  3 14]    512M    512M     64M     32M     16M      8M      1G
     [13  5  8]    256M    256M    512M    128M    256M    128M      1G
     [13  5 10]     64M     32M     64M     16M    256K    256K      1G
     [13  9  8]    128M     64M    512M    512M    512M    128M      1G
     [13 10 12]      2M      2M    128K    128K    128K     64K    512M
     [13 11 14]     16M     16M      8M      8M      8M      8M      1G
     [13 12 14]     16M     16M      8M      8M      4M      4M      1G
     [13 13 14]     16M     16M      8M      8M      8M      8M      1G
     [14  1 11]     64M     32M    256K    256K    256K    256K      1G
     [14  2  7]      1G    512M      1G    512M    512M    128M      1G
     [14  2  9]    512M    256M    128M    128M     64M    128M      1G
     [14  3 13]     16M     16M      1M    256K     64K     64K      1G
     [14  8  9]    128M     64M      1G     64M     64M     64M      1G
     [14 11  3]    512M    512M    256M    128M    128M     64M      1G
     [14 11 11]     16M      8M    256K    256K    128K    256K      1G
     [14 11 13]    512K    512K    128K     64K     64K     64K      1G
     [14 12 13]    512K    256K    128K     64K     64K     64K      1G
     [14 13 13]    128K    256K     64K     64K    128K     64K    256M
     [15  1  2]      2M      2M      1M    512K    512K    256K      1G
     [15  3  6]      1G    512M    512M    512M    256M    128M      1G
     [15  4 12]    128M     64M    128M      8M    256K    256K      1G
     [15  6  2]    128M    256M    128M    128M     32M     16M      1G
     [15  7  4]    512M    128M    512M    512M    256M    128M      1G
     [15  7  8]     64M     64M     32M     32M      4M      2M    512M
    
    $50,000 buys you a discrediting of a journalist
  • Looks good, Evanh.

    I think ours will probably be used for bits 15:01 and for bits 15:08. So, (14,2,7) looks the best for that, and that's what's in the Verilog.
Sign In or Register to comment.