Skip to content

Instantly share code, notes, and snippets.

@velipso
Created July 27, 2016 02:20
Show Gist options
  • Save velipso/d112165a26b45244a65298933c0349a4 to your computer and use it in GitHub Desktop.
Save velipso/d112165a26b45244a65298933c0349a4 to your computer and use it in GitHub Desktop.
$ cat smush.c
#include <stdio.h>
#include <stdint.h>
static uint32_t seed = 0, i = 0;
uint32_t smush(){
const uint32_t m = 0x5bd1e995;
const uint32_t k = i++ * m;
seed = (k ^ (k >> 24) ^ (seed * m)) * m;
return seed ^ (seed >> 13);
}
void smush_seed(uint32_t s){
seed = s;
i = 0;
}
int main(){
smush_seed(0);
const int SZ = 128;
uint32_t v[SZ];
while (1){
for (int vi = 0; vi < SZ; vi++)
v[vi] = smush();
fwrite(v, sizeof(uint32_t), SZ, stdout);
}
return 0;
}
$ clang smush.c
$ ./a.out | dieharder -g 200 -a
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name |rands/second| Seed |
stdin_input_raw| 1.45e+07 |4147991336|
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
diehard_birthdays| 0| 100| 100|0.19944545| PASSED
diehard_operm5| 0| 1000000| 100|0.74264962| PASSED
diehard_rank_32x32| 0| 40000| 100|0.81169086| PASSED
diehard_rank_6x8| 0| 100000| 100|0.85456617| PASSED
diehard_bitstream| 0| 2097152| 100|0.98344101| PASSED
diehard_opso| 0| 2097152| 100|0.54080010| PASSED
diehard_oqso| 0| 2097152| 100|0.95169716| PASSED
diehard_dna| 0| 2097152| 100|0.68266923| PASSED
diehard_count_1s_str| 0| 256000| 100|0.47245217| PASSED
diehard_count_1s_byt| 0| 256000| 100|0.24399342| PASSED
diehard_parking_lot| 0| 12000| 100|0.95039058| PASSED
diehard_2dsphere| 2| 8000| 100|0.34591501| PASSED
diehard_3dsphere| 3| 4000| 100|0.75090321| PASSED
diehard_squeeze| 0| 100000| 100|0.84018313| PASSED
diehard_sums| 0| 100| 100|0.09349280| PASSED
diehard_runs| 0| 100000| 100|0.50367025| PASSED
diehard_runs| 0| 100000| 100|0.42189742| PASSED
diehard_craps| 0| 200000| 100|0.58970815| PASSED
diehard_craps| 0| 200000| 100|0.89238872| PASSED
marsaglia_tsang_gcd| 0| 10000000| 100|0.75754520| PASSED
marsaglia_tsang_gcd| 0| 10000000| 100|0.40828210| PASSED
sts_monobit| 1| 100000| 100|0.35297354| PASSED
sts_runs| 2| 100000| 100|0.60070527| PASSED
sts_serial| 1| 100000| 100|0.94720042| PASSED
sts_serial| 2| 100000| 100|0.38520039| PASSED
sts_serial| 3| 100000| 100|0.29213975| PASSED
sts_serial| 3| 100000| 100|0.43331393| PASSED
sts_serial| 4| 100000| 100|0.24317343| PASSED
sts_serial| 4| 100000| 100|0.61551843| PASSED
sts_serial| 5| 100000| 100|0.64944083| PASSED
sts_serial| 5| 100000| 100|0.99252546| PASSED
sts_serial| 6| 100000| 100|0.61063713| PASSED
sts_serial| 6| 100000| 100|0.70679270| PASSED
sts_serial| 7| 100000| 100|0.63370887| PASSED
sts_serial| 7| 100000| 100|0.25893797| PASSED
sts_serial| 8| 100000| 100|0.80580143| PASSED
sts_serial| 8| 100000| 100|0.97250537| PASSED
sts_serial| 9| 100000| 100|0.92208135| PASSED
sts_serial| 9| 100000| 100|0.29669187| PASSED
sts_serial| 10| 100000| 100|0.32298245| PASSED
sts_serial| 10| 100000| 100|0.56279922| PASSED
sts_serial| 11| 100000| 100|0.90521649| PASSED
sts_serial| 11| 100000| 100|0.84207527| PASSED
sts_serial| 12| 100000| 100|0.66602966| PASSED
sts_serial| 12| 100000| 100|0.71155283| PASSED
sts_serial| 13| 100000| 100|0.51729250| PASSED
sts_serial| 13| 100000| 100|0.19397948| PASSED
sts_serial| 14| 100000| 100|0.87515332| PASSED
sts_serial| 14| 100000| 100|0.93489315| PASSED
sts_serial| 15| 100000| 100|0.39138148| PASSED
sts_serial| 15| 100000| 100|0.71792438| PASSED
sts_serial| 16| 100000| 100|0.51441051| PASSED
sts_serial| 16| 100000| 100|0.05726800| PASSED
rgb_bitdist| 1| 100000| 100|0.82789079| PASSED
rgb_bitdist| 2| 100000| 100|0.97062533| PASSED
rgb_bitdist| 3| 100000| 100|0.90346150| PASSED
rgb_bitdist| 4| 100000| 100|0.96392540| PASSED
rgb_bitdist| 5| 100000| 100|0.83234796| PASSED
rgb_bitdist| 6| 100000| 100|0.44063839| PASSED
rgb_bitdist| 7| 100000| 100|0.85365912| PASSED
rgb_bitdist| 8| 100000| 100|0.34746079| PASSED
rgb_bitdist| 9| 100000| 100|0.44965069| PASSED
rgb_bitdist| 10| 100000| 100|0.97723451| PASSED
rgb_bitdist| 11| 100000| 100|0.21182369| PASSED
rgb_bitdist| 12| 100000| 100|0.36486940| PASSED
rgb_minimum_distance| 2| 10000| 1000|0.99401893| PASSED
rgb_minimum_distance| 3| 10000| 1000|0.11374992| PASSED
rgb_minimum_distance| 4| 10000| 1000|0.18398520| PASSED
rgb_minimum_distance| 5| 10000| 1000|0.54175270| PASSED
rgb_permutations| 2| 100000| 100|0.43755807| PASSED
rgb_permutations| 3| 100000| 100|0.77883713| PASSED
rgb_permutations| 4| 100000| 100|0.06084796| PASSED
rgb_permutations| 5| 100000| 100|0.97660091| PASSED
rgb_lagged_sum| 0| 1000000| 100|0.61926984| PASSED
rgb_lagged_sum| 1| 1000000| 100|0.39573233| PASSED
rgb_lagged_sum| 2| 1000000| 100|0.04478308| PASSED
rgb_lagged_sum| 3| 1000000| 100|0.80266967| PASSED
rgb_lagged_sum| 4| 1000000| 100|0.72094698| PASSED
rgb_lagged_sum| 5| 1000000| 100|0.98045117| PASSED
rgb_lagged_sum| 6| 1000000| 100|0.50002527| PASSED
rgb_lagged_sum| 7| 1000000| 100|0.42402066| PASSED
rgb_lagged_sum| 8| 1000000| 100|0.49205427| PASSED
rgb_lagged_sum| 9| 1000000| 100|0.17798328| PASSED
rgb_lagged_sum| 10| 1000000| 100|0.72059378| PASSED
rgb_lagged_sum| 11| 1000000| 100|0.92028309| PASSED
rgb_lagged_sum| 12| 1000000| 100|0.74261569| PASSED
rgb_lagged_sum| 13| 1000000| 100|0.19597317| PASSED
rgb_lagged_sum| 14| 1000000| 100|0.96546697| PASSED
rgb_lagged_sum| 15| 1000000| 100|0.48856635| PASSED
rgb_lagged_sum| 16| 1000000| 100|0.86991990| PASSED
rgb_lagged_sum| 17| 1000000| 100|0.29753333| PASSED
rgb_lagged_sum| 18| 1000000| 100|0.46923912| PASSED
rgb_lagged_sum| 19| 1000000| 100|0.45896598| PASSED
rgb_lagged_sum| 20| 1000000| 100|0.78220650| PASSED
rgb_lagged_sum| 21| 1000000| 100|0.26978699| PASSED
rgb_lagged_sum| 22| 1000000| 100|0.52740664| PASSED
rgb_lagged_sum| 23| 1000000| 100|0.38671516| PASSED
rgb_lagged_sum| 24| 1000000| 100|0.61563441| PASSED
rgb_lagged_sum| 25| 1000000| 100|0.07109813| PASSED
rgb_lagged_sum| 26| 1000000| 100|0.10007919| PASSED
rgb_lagged_sum| 27| 1000000| 100|0.63021920| PASSED
rgb_lagged_sum| 28| 1000000| 100|0.49809049| PASSED
rgb_lagged_sum| 29| 1000000| 100|0.09982088| PASSED
rgb_lagged_sum| 30| 1000000| 100|0.42569548| PASSED
rgb_lagged_sum| 31| 1000000| 100|0.81904161| PASSED
rgb_lagged_sum| 32| 1000000| 100|0.44105507| PASSED
rgb_kstest_test| 0| 10000| 1000|0.43246273| PASSED
dab_bytedistrib| 0| 51200000| 1|0.62540045| PASSED
dab_dct| 256| 50000| 1|0.90429551| PASSED
Preparing to run test 207. ntuple = 0
dab_filltree| 32| 15000000| 1|0.22755116| PASSED
dab_filltree| 32| 15000000| 1|0.73413620| PASSED
Preparing to run test 208. ntuple = 0
dab_filltree2| 0| 5000000| 1|0.94235454| PASSED
dab_filltree2| 1| 5000000| 1|0.49841784| PASSED
Preparing to run test 209. ntuple = 0
dab_monobit2| 12| 65000000| 1|0.58337203| PASSED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment