├── scripts ├── size.sh └── path.sh ├── src ├── FILES ├── api.c ├── rng.c └── ent.c ├── include ├── defs.h ├── ent.h ├── util.h ├── rng.h ├── simd.h ├── api.h └── test.h ├── LICENSE ├── Makefile ├── tests ├── PractRand-Standard.txt ├── gjrand-1MDBL.txt ├── gjrand-10MDBL.txt ├── gjrand-100MDBL.txt ├── gjrand-1BDBL.txt ├── gjrand-10BDBL.txt ├── gjrand-10MB.txt ├── gjrand-100MB.txt ├── gjrand-1GB.txt ├── gjrand-10GB.txt ├── gjrand-100GB.txt ├── Dieharder.txt ├── SmallCrush.txt ├── NIST-10MB.txt ├── NIST-100MB.txt └── NIST-1GB.txt ├── README.md └── TESTING.md /scripts/size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | args=("$@") 4 | size=$(ls -lh ${args[0]} | grep -oE '[0-9]+[KMB]'); 5 | printf "\033[1;32mFinished!\033[m (\033[1m%sB\033[m)\n" "$size" -------------------------------------------------------------------------------- /scripts/path.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | args=("$@") 4 | printf "\n\033[1;36mAdd ADAM to your PATH? [y/n]\033[m" 5 | read ans 6 | if [[ $ans == "Y" || $ans == "y" ]] ; then 7 | sudo cp ${args[0]} /usr/local/bin/${args[1]} 8 | printf "\033[1;32mADAM is now in your path. Run adam -h to get started!\033[m\n" 9 | else 10 | printf "ADAM was not added to your path.\n" 11 | fi -------------------------------------------------------------------------------- /src/FILES: -------------------------------------------------------------------------------- 1 | ========================================================================================== 2 | FILE IMPLEMENTATION FOCUS 3 | ========================================================================================== 4 | api.c The standard API functions for libadam and adam_data struct definition. 5 | cli.c CLI entry point - option parsing, pretty printing info, manipulating ADAM. 6 | ent.c ENT framework code with some arrangement tweaks to work with the adam CLI. 7 | rng.c Where the magic happens! All the necessary primitives for ADAM. 8 | test.c Some tests and measurements of statistical quality, for the -e CLI option. 9 | util.c Miscellaneous helpers and utility functions for CLI and testing suite. -------------------------------------------------------------------------------- /include/defs.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFS_H 2 | #define DEFS_H 3 | #include 4 | #include 5 | 6 | typedef uint8_t u8; 7 | typedef uint16_t u16; 8 | typedef uint32_t u32; 9 | typedef uint64_t u64; 10 | typedef __uint128_t u128; 11 | typedef __SIZE_TYPE__ size_t; 12 | 13 | #define ALIGN(x) __attribute__ ((aligned (x))) 14 | #define CTZ __builtin_ctz 15 | #define MEMCPY __builtin_memcpy 16 | #define MEMSET __builtin_memset 17 | #define POPCNT __builtin_popcountll 18 | #define LIKELY(x) __builtin_expect((x), 1) 19 | #define UNLIKELY(x) __builtin_expect((x), 0) 20 | #endif 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2022 Preeth Vijay 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /include/ent.h: -------------------------------------------------------------------------------- 1 | #ifndef ENT_H 2 | #define ENT_H 3 | #include "defs.h" 4 | 5 | // General ent stuff 6 | #define PI 3.141592653589793238 7 | 8 | #define log2of10 3.32192809488736234787 9 | 10 | /* 11 | Bytes used as Monte Carlo co-ordinates. 12 | This should be no more bits than the mantissa of your 13 | "double" floating point type. 14 | */ 15 | #define MONTEN 6 16 | 17 | // Ent chi square distribution calculation stuff 18 | 19 | #define Z_MAX 6.0 /* maximum meaningful z value */ 20 | #define LOG_SQRT_PI 0.5723649429247000870717135 /* log (sqrt (pi)) */ 21 | #define I_SQRT_PI 0.5641895835477562869480795 /* 1 / sqrt (pi) */ 22 | #define BIGX 20.0 /* max value to represent exp (x) */ 23 | 24 | typedef struct ent_test { 25 | double ent; 26 | double chisq; 27 | double pochisq; 28 | double mean; 29 | double montepicalc; 30 | double monterr; 31 | double scc; 32 | double sccu0; 33 | u64 *freq; 34 | } ent_test; 35 | 36 | void ent_loop(const u8 *num); 37 | void ent_results(ent_test *rsl); 38 | #endif -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .POSIX: 2 | .PHONY: comp, all, addpath 3 | 4 | CC = gcc 5 | CFLAGS = -std=c99 -Iinclude 6 | UNAME_S := $(shell uname -m) 7 | 8 | ifeq ($(UNAME_S),x86_64) 9 | CFLAGS += -march=native -mtune=native 10 | else ifeq ($(UNAME_S),arm64) 11 | CFLAGS += -march=armv8.4-a+sha3 12 | endif 13 | 14 | ifeq ($(DEBUG),1) 15 | CFLAGS += -g -O0 -Wall -DDEBUG -Wextra -Werror -pedantic 16 | else 17 | CFLAGS += -O3 -fomit-frame-pointer -fwrapv -flto 18 | endif 19 | 20 | BINARY = adam2 21 | LIBRARY = lib$(BINARY).a 22 | BUILD_DIR = ./build 23 | BIN_PATH := $(BUILD_DIR)/$(BINARY) 24 | LIB_PATH := $(BUILD_DIR)/$(LIBRARY) 25 | 26 | STD_LIB = rng api 27 | LIB_OBJ = $(STD_LIB:%=%.o) 28 | CLI = ent test util cli 29 | OBJ := $(CLI:%=%.o) $(LIB_OBJ) 30 | 31 | all: comp cli lib addpath 32 | @rm $(OBJ) 33 | 34 | comp: 35 | @printf "\033[1;36mCompiling sources...\033[m\n" 36 | 37 | %.o: src/%.c 38 | $(CC) $(CFLAGS) -c $^ 39 | 40 | cli: $(OBJ) 41 | @printf "\n\033[1;36mBuilding ADAM CLI...\033[m\n" 42 | @mkdir -p $(BUILD_DIR) 43 | $(CC) -o $(BIN_PATH) $(OBJ) -lm 44 | @./scripts/size.sh $(BIN_PATH) 45 | 46 | lib: $(LIB_OBJ) 47 | @printf "\n\033[1;36mBuilding ADAM library...\033[m\n" 48 | ar rcs $(LIB_PATH) $(LIB_OBJ) 49 | @./scripts/size.sh $(LIB_PATH) 50 | @cp include/api.h $(BUILD_DIR)/adam.h 51 | @printf "\033[1;32mLibrary and header written to \033[m$(BUILD_DIR)\n" 52 | 53 | addpath: 54 | @./scripts/path.sh $(BIN_PATH) $(BINARY) 55 | -------------------------------------------------------------------------------- /include/util.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_H 2 | #define UTIL_H 3 | #include "test.h" 4 | 5 | void get_print_metrics(u16 *center, u16 *indent, u16 *swidth); 6 | u8 err(const char *s); 7 | u64 a_to_u(const char *s, const u64 min, const u64 max); 8 | u8 gen_uuid(const u64 higher, const u64 lower, u8 *buf); 9 | u8 nearest_space(const char *str, u8 offset); 10 | double wh_transform(const u16 idx, const u32 test, const u8 offset); 11 | void print_ascii_bits(u64 *_ptr, const u64 limit); 12 | void print_clock_report(const double khz, const double gbps, const double cycles, const double cpu, const int runs); 13 | 14 | /* adam_examine() RESULTS PRINTING STUFF */ 15 | 16 | void print_basic_results(const u16 indent, const u64 limit, const basic_test *rsl); 17 | void print_mfreq_results(const u16 indent, const u64 output, const mfreq_test *rsl); 18 | void print_byte_results(const u16 indent, const basic_test *rsl); 19 | void print_range_results(const u16 indent, const u64 output, const range_test *rsl); 20 | void print_ent_results(const u16 indent, const ent_test *rsl); 21 | void print_chseed_results(const u16 indent, const basic_test *rsl); 22 | void print_fp_results(const u16 indent, const u64 output, const fp_test *fp); 23 | void print_sp_results(const u16 indent, const rng_test *rsl, const u64 *sat_dist, const u64 *sat_range); 24 | void print_maurer_results(const u16 indent, maurer_test *rsl); 25 | void print_tbt_results(const u16 indent, const tb_test *topo); 26 | void print_vnt_results(const u16 indent, const vn_test *von); 27 | void print_avalanche_results(const u16 indent, const basic_test *rsl, const u64 *ham_dist); 28 | void print_wht_results(const u16 indent, const wh_test *walsh); 29 | #endif -------------------------------------------------------------------------------- /include/rng.h: -------------------------------------------------------------------------------- 1 | #ifndef RNG_H 2 | #define RNG_H 3 | #include "defs.h" 4 | 5 | /* 6 | Size of the internal chaotic buffer used to generate numbers 7 | The buffer is of type [u64; 256] with size 256 * 8 = 2048 bytes 8 | */ 9 | #define MAGNITUDE 8 10 | #define BUF_SIZE (1U << MAGNITUDE) 11 | 12 | // Number of rounds we perform at a time 13 | #define ROUNDS 8 14 | 15 | /* 16 | The CSPRNG prepares itself for number generation using the function: 17 | 18 | 3.9999 * X * (1 - X) 19 | 20 | CHFUNCTION is used for updating internal state using the output of the 21 | chaotic function 22 | 23 | CHMANT32 is for extracting the lower 32 bits of the chaotic value's 24 | binary representation. 25 | 26 | Must take the mod 7 of x because it will be the data->buff_idx member 27 | */ 28 | #define COEFFICIENT 3.9999 29 | #define CHFUNCTION(x, ch) (COEFFICIENT * ch[x & 7] * (1.0 - ch[x & 7])) 30 | #define CHMANT32(x, ch) (*((u64 *) &ch[x & 7]) & __UINT32_MAX__) 31 | 32 | // To approximate (D / (double) __UINT64_MAX__) * 0.5 for a random int casted to double D 33 | #define RANGE_LIMIT 2.7105054E-20 34 | 35 | /* The main primitives for using ADAM's algorithm */ 36 | 37 | void initialize(const u64 *restrict seed, const u64 nonce, u64 *restrict out, u64 *restrict mix); 38 | void accumulate(u64 *restrict out, u64 *restrict mix, double *restrict chseeds); 39 | void diffuse(u64 *restrict out, u64 *restrict mix, const u64 nonce); 40 | void apply(u64 *restrict out, double *restrict chseeds); 41 | void mix(u64 *restrict out, const u64 *restrict mix); 42 | u64 generate(u64 *restrict out, u8 *restrict idx, double *restrict chseeds); 43 | #endif 44 | -------------------------------------------------------------------------------- /tests/PractRand-Standard.txt: -------------------------------------------------------------------------------- 1 | RNG_test using PractRand version 0.93 2 | RNG = RNG_stdin8, seed = 0x5dd2bcaa 3 | test set = normal, folding = standard (8 bit) 4 | 5 | rng=RNG_stdin8, seed=0x5dd2bcaa 6 | length= 512 megabytes (2^29 bytes), time= 3.3 seconds 7 | no anomalies in 92 test result(s) 8 | 9 | rng=RNG_stdin8, seed=0x5dd2bcaa 10 | length= 1 gigabyte (2^30 bytes), time= 6.8 seconds 11 | no anomalies in 98 test result(s) 12 | 13 | rng=RNG_stdin8, seed=0x5dd2bcaa 14 | length= 2 gigabytes (2^31 bytes), time= 13.7 seconds 15 | no anomalies in 104 test result(s) 16 | 17 | rng=RNG_stdin8, seed=0x5dd2bcaa 18 | length= 4 gigabytes (2^32 bytes), time= 27.4 seconds 19 | no anomalies in 108 test result(s) 20 | 21 | rng=RNG_stdin8, seed=0x5dd2bcaa 22 | length= 8 gigabytes (2^33 bytes), time= 55.5 seconds 23 | no anomalies in 114 test result(s) 24 | 25 | rng=RNG_stdin8, seed=0x5dd2bcaa 26 | length= 16 gigabytes (2^34 bytes), time= 111 seconds 27 | no anomalies in 120 test result(s) 28 | 29 | rng=RNG_stdin8, seed=0x5dd2bcaa 30 | length= 32 gigabytes (2^35 bytes), time= 221 seconds 31 | no anomalies in 124 test result(s) 32 | 33 | rng=RNG_stdin8, seed=0x5dd2bcaa 34 | length= 64 gigabytes (2^36 bytes), time= 450 seconds 35 | no anomalies in 130 test result(s) 36 | 37 | rng=RNG_stdin8, seed=0x5dd2bcaa 38 | length= 128 gigabytes (2^37 bytes), time= 902 seconds 39 | no anomalies in 136 test result(s) 40 | 41 | rng=RNG_stdin8, seed=0x5dd2bcaa 42 | length= 256 gigabytes (2^38 bytes), time= 1784 seconds 43 | no anomalies in 140 test result(s) 44 | 45 | rng=RNG_stdin8, seed=0x5dd2bcaa 46 | length= 512 gigabytes (2^39 bytes), time= 3590 seconds 47 | no anomalies in 146 test result(s) 48 | 49 | rng=RNG_stdin8, seed=0x5dd2bcaa 50 | length= 1 terabyte (2^40 bytes), time= 7180 seconds 51 | no anomalies in 152 test result(s) 52 | 53 | rng=RNG_stdin8, seed=0x5dd2bcaa 54 | length= 2 terabytes (2^41 bytes), time= 14055 seconds 55 | no anomalies in 156 test result(s) 56 | 57 | rng=RNG_stdin8, seed=0x5dd2bcaa 58 | length= 4 terabytes (2^42 bytes), time= 27977 seconds 59 | no anomalies in 162 test result(s) 60 | 61 | rng=RNG_stdin8, seed=0x5dd2bcaa 62 | length= 8 terabytes (2^43 bytes), time= 55481 seconds 63 | no anomalies in 168 test result(s) 64 | 65 | rng=RNG_stdin8, seed=0x5dd2bcaa 66 | length= 16 terabytes (2^44 bytes), time= 111409 seconds 67 | no anomalies in 172 test result(s) -------------------------------------------------------------------------------- /tests/gjrand-1MDBL.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCPF version 13 --tiny ***** 3 | 4 | 5 | 6 | ============ 7 | tri 1/1 (1048576 doubles) 8 | ======= 9 | blocksize = 64 10 | lo var 2.1984; skew 1.722; m5 2.5963; 11 | mid var -0.53859; skew -0.22419; m5 0.003368; 12 | hi var -0.0070764; skew 0.36314; m5 0.21226; 13 | blocksize = 256 14 | lo var 2.006; skew -0.21705; m5 -0.19057; 15 | mid var 0.20206; skew -0.15663; m5 0.6621; 16 | hi var -0.43816; skew 1.0701; m5 1.2003; 17 | blocksize = 1024 18 | lo var 1.7263; skew -0.53459; m5 -1.2143; 19 | mid var -0.98597; skew 0.75103; m5 1.6211; 20 | hi var 0.56056; skew 0.21289; m5 0.43247; 21 | blocksize = 4096 22 | lo var -1.0188; skew 0.34716; m5 0.22164; mean 0.42606; 23 | mid var -1.5862; skew -0.45197; m5 -0.05064; mean -0.51238; 24 | hi var -0.8722; skew 0.16414; m5 0.13124; mean 0.086317; 25 | 26 | processed 1e+06 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 27 | 28 | one sided P value (very small numbers are bad) 29 | P = 0.309 30 | ... after 1 tests running guess [p] = 0.31 31 | 32 | 33 | ============ 34 | nda8 1/1 (1048576 doubles) 35 | ======= 36 | extreme = 9.57e-05 (2 15 9 +) 37 | transform = 3.87 (a c 28) 38 | pvals (0.692 0.734) 39 | 40 | processed 1e+06 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 41 | 42 | one sided P value (very small numbers are bad) 43 | P = 0.905 44 | ... after 2 tests running guess [p] = 0.52 45 | 46 | 47 | ============ 48 | nda4 1/1 (1048576 doubles) 49 | ======= 50 | extreme = 0.000195 (1 3 35 +) 51 | transform = 3.77 (e d 1) 52 | pvals (0.909 0.869) 53 | 54 | processed 1e+06 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 55 | 56 | one sided P value (very small numbers are bad) 57 | P = 0.983 58 | ... after 3 tests running guess [p] = 0.67 59 | 60 | 61 | ============ 62 | rda 1/2 (524288 doubles) 63 | ======= 64 | simple 65 | chis = 9970 (p = 0.577) 66 | extreme = 0.000618 (3198 -) (p = 0.998) 67 | zero1st = 0.00123 (581 +) (p = 1) 68 | ext = 90 ; exk = 18 ; expect = 7.33 69 | 70 | zero1st 71 | zero1st = 0.000412 (1414 -) (p = 0.984) 72 | ext = 70 ; exk = 2 ; expect = 13.1 73 | 74 | 75 | processed 5.1e+05 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 76 | 77 | one sided P value (very small numbers are bad) 78 | P = 0.968 79 | ... after 4 tests running guess [p] = 0.77 80 | 81 | 82 | ============ 83 | dim3 1/3 (349525 doubles) 84 | ======= 85 | count = 4.81219 sigma (p = 0.323) (transformed) 86 | sum = 4.63116 sigma (p = 0.614) (transformed) 87 | abs = 4.74227 sigma (p = 0.425) (transformed) 88 | 89 | processed 3.5e+05 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 90 | 91 | one sided P value (very small numbers are bad) 92 | P = 0.69 93 | ... after 5 tests running guess [p] = 0.84 94 | 95 | 96 | ============ 97 | dim56 1/4 (262144 doubles) 98 | ======= 99 | sum 1 = 5.14115 sigma (p = 0.0691) (transformed) 100 | abs 1 = 4.28868 sigma (p = 0.991) (transformed) 101 | sum 2 = 4.61127 sigma (p = 0.65) (transformed) 102 | abs 2 = 4.94849 sigma (p = 0.178) (transformed) 103 | 104 | processed 2.6e+05 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 105 | 106 | one sided P value (very small numbers are bad) 107 | P = 0.249 108 | ... after 6 tests running guess [p] = 0.82 109 | 110 | 111 | ============ 112 | chi 1/32 (32768 doubles) 113 | ======= 114 | expected range [ 191 205 227 284 310 331 ] 115 | 255.39062 116 | 261.37500 117 | 280.81250 118 | 281.82812 119 | 237.70312 120 | 238.10938 121 | 122 | processed 3.3e+04 numbers in 0 seconds. Fri Feb 16 20:54:12 2024 123 | 124 | one sided P value (very small numbers are bad) 125 | P = 0.805 126 | 127 | 128 | ==================== 129 | completed 7 tests 130 | 7 out of 7 tests ok. 131 | 132 | 133 | Overall summary one sided P-value (smaller numbers bad) 134 | P = 0.865 : ok -------------------------------------------------------------------------------- /include/simd.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMD_H 2 | #define SIMD_H 3 | #if defined(__aarch64__) && defined(__ARM_NEON) 4 | #include // CORE 5 | #include // SIMD 6 | 7 | typedef uint8x16_t reg8q; 8 | typedef uint8x16x4_t reg8q4; 9 | typedef uint64x2_t reg64q; 10 | typedef uint64x2x4_t reg64q4; 11 | typedef float64x2_t dregq; 12 | typedef float64x2x4_t dreg4q; 13 | 14 | #define SIMD_LEN 64 15 | #define SIMD_LOAD8x4 vld1q_u8_x4 16 | #define SIMD_STORE8x4 vst1q_u8_x4 17 | #define SIMD_MOV8 vmov_n_u8 18 | #define SIMD_CREATE8 vcreate_u8 19 | #define SIMD_COMBINE8 vcombine_u8 20 | #define SIMD_SET8 vdupq_n_u8 21 | #define SIMD_SETQ8 vld4q_dup_u8 22 | #define SIMD_ADD8 vaddq_u8 23 | #define SIMD_CMPEQ8 vceqq_u8 24 | #define SIMD_AND8 vandq_u8 25 | #define SIMD_LOAD64 vld1q_u64 26 | #define SIMD_LOAD64x4 vld1q_u64_x4 27 | #define SIMD_STORE64x4 vst1q_u64_x4 28 | #define SIMD_SET64 vdup_n_u64 29 | #define SIMD_SETQ64 vdupq_n_u64 30 | #define SIMD_ADD64 vaddq_u64 31 | #define SIMD_XOR64 veorq_u64 32 | #define SIMD_XAR64 vxarq_u64 33 | #define SIMD_STOREPD vst1q_f64 34 | #define SIMD_STORE4PD vst1q_f64_x4 35 | #define SIMD_LOAD4PD vld1q_f64_x4 36 | #define SIMD_CASTPD vcvtq_f64_u64 37 | #define SIMD_SETQPD vdupq_n_f64 38 | #define SIMD_SUBPD vsubq_f64 39 | #define SIMD_MULPD vmulq_f64 40 | 41 | #define SIMD_ADD4Q8(s1, s2, s3) \ 42 | s1.val[0] = SIMD_ADD8(s2.val[0], s3), \ 43 | s1.val[1] = SIMD_ADD8(s2.val[1], s3), \ 44 | s1.val[2] = SIMD_ADD8(s2.val[2], s3), \ 45 | s1.val[3] = SIMD_ADD8(s2.val[3], s3) 46 | 47 | #define SIMD_CMP4QEQ8(s1, s2, s3) \ 48 | s1.val[0] = SIMD_CMPEQ8(s2.val[0], s3), \ 49 | s1.val[1] = SIMD_CMPEQ8(s2.val[1], s3), \ 50 | s1.val[2] = SIMD_CMPEQ8(s2.val[2], s3), \ 51 | s1.val[3] = SIMD_CMPEQ8(s2.val[3], s3) 52 | 53 | #define SIMD_AND4Q8(s1, s2, s3) \ 54 | s1.val[0] = SIMD_AND8(s2.val[0], s3), \ 55 | s1.val[1] = SIMD_AND8(s2.val[1], s3), \ 56 | s1.val[2] = SIMD_AND8(s2.val[2], s3), \ 57 | s1.val[3] = SIMD_AND8(s2.val[3], s3) 58 | 59 | #define SIMD_ADD4RQ64(s1, s2, s3) \ 60 | s1.val[0] = SIMD_ADD64(s2.val[0], s3.val[0]), \ 61 | s1.val[1] = SIMD_ADD64(s2.val[1], s3.val[1]), \ 62 | s1.val[2] = SIMD_ADD64(s2.val[2], s3.val[2]), \ 63 | s1.val[3] = SIMD_ADD64(s2.val[3], s3.val[3]) 64 | 65 | #define SIMD_3XOR4Q64(s1, s2, s3) \ 66 | s1.val[0] = veor3q_u64(s1.val[0], s2.val[0], s3.val[0]), \ 67 | s1.val[1] = veor3q_u64(s1.val[1], s2.val[1], s3.val[1]), \ 68 | s1.val[2] = veor3q_u64(s1.val[2], s2.val[2], s3.val[2]), \ 69 | s1.val[3] = veor3q_u64(s1.val[3], s2.val[3], s3.val[3]) 70 | 71 | #define SIMD_CAST4QPD(s1, s2) \ 72 | s1.val[0] = SIMD_CASTPD(s2.val[0]), \ 73 | s1.val[1] = SIMD_CASTPD(s2.val[1]), \ 74 | s1.val[2] = SIMD_CASTPD(s2.val[2]), \ 75 | s1.val[3] = SIMD_CASTPD(s2.val[3]) 76 | 77 | #define SIMD_XAR64RQ(s1, s2, s3, n) \ 78 | s1.val[0] = vxarq_u64(s2.val[0], s3.val[0], n), \ 79 | s1.val[1] = vxarq_u64(s2.val[1], s3.val[1], n), \ 80 | s1.val[2] = vxarq_u64(s2.val[2], s3.val[2], n), \ 81 | s1.val[3] = vxarq_u64(s2.val[3], s3.val[3], n) \ 82 | 83 | #define SIMD_SUB4QPD(s1, s2, s3) \ 84 | s1.val[0] = SIMD_SUBPD(s2, s3.val[0]), \ 85 | s1.val[1] = SIMD_SUBPD(s2, s3.val[1]), \ 86 | s1.val[2] = SIMD_SUBPD(s2, s3.val[2]), \ 87 | s1.val[3] = SIMD_SUBPD(s2, s3.val[3]) 88 | 89 | #define SIMD_MUL4QPD(s1, s2, s3) \ 90 | s1.val[0] = SIMD_MULPD(s2.val[0], s3), \ 91 | s1.val[1] = SIMD_MULPD(s2.val[1], s3), \ 92 | s1.val[2] = SIMD_MULPD(s2.val[2], s3), \ 93 | s1.val[3] = SIMD_MULPD(s2.val[3], s3) 94 | 95 | #define SIMD_MUL4RQPD(s1, s2, s3) \ 96 | s1.val[0] = SIMD_MULPD(s2.val[0], s3.val[0]), \ 97 | s1.val[1] = SIMD_MULPD(s2.val[1], s3.val[1]), \ 98 | s1.val[2] = SIMD_MULPD(s2.val[2], s3.val[2]), \ 99 | s1.val[3] = SIMD_MULPD(s2.val[3], s3.val[3]) 100 | 101 | #define SIMD_REINTERP_ADD64(s1, d1, s2) \ 102 | s1.val[0] = SIMD_ADD64(vandq_u64(vreinterpretq_u64_f64(d1.val[0]), mask), s2.val[0]); \ 103 | s1.val[1] = SIMD_ADD64(vandq_u64(vreinterpretq_u64_f64(d1.val[1]), mask), s2.val[1]); \ 104 | s1.val[2] = SIMD_ADD64(vandq_u64(vreinterpretq_u64_f64(d1.val[2]), mask), s2.val[2]); \ 105 | s1.val[3] = SIMD_ADD64(vandq_u64(vreinterpretq_u64_f64(d1.val[3]), mask), s2.val[3]); 106 | #else 107 | #error "ADAM requires AArch64 + NEON. Please build on an ARM64 system (Apple Silicon, Linux ARM64, or Windows ARM)." 108 | #endif 109 | #endif 110 | -------------------------------------------------------------------------------- /src/api.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "../include/api.h" 6 | #include "../include/rng.h" 7 | 8 | struct adam_data_s { 9 | // 256-bit seed 10 | u64 seed[4]; 11 | 12 | // 64-bit nonce 13 | u32 nonce[3]; 14 | 15 | // Chaotic work buffer - 256 64-bit integers = 2048 bytes 16 | u64 out[BUF_SIZE] ALIGN(ADAM_ALIGNMENT); 17 | 18 | // The seeds supplied to each iteration of the chaotic function 19 | double chseeds[ROUNDS] ALIGN(ADAM_ALIGNMENT); 20 | 21 | // Current index in buffer 22 | u8 buff_idx; 23 | }; 24 | 25 | adam_data_t adam_setup(u64 *seed, u32 *nonce) 26 | { 27 | // Allocate the struct 28 | adam_data_t data = aligned_alloc(ADAM_ALIGNMENT, sizeof(*data)); 29 | if (data == NULL) { 30 | return NULL; 31 | } 32 | 33 | adam_reset(data, seed, nonce); 34 | 35 | return data; 36 | } 37 | 38 | int adam_reset(adam_data_t data, u64 *seed, u32 *nonce) 39 | { 40 | // Get nonce from secure system RNG, or use user provided nonce 41 | if (nonce == NULL) { 42 | getentropy(data->nonce, ADAM_NONCE_SIZE); 43 | } else { 44 | data->nonce[0] = nonce[0]; 45 | data->nonce[1] = nonce[1]; 46 | data->nonce[2] = nonce[2]; 47 | } 48 | 49 | // Get seed bytes from secure system RNG, or use user provided seed 50 | if (seed == NULL) { 51 | getentropy(data->seed, ADAM_SEED_SIZE); 52 | } else { 53 | data->seed[0] = seed[0]; 54 | data->seed[1] = seed[1]; 55 | data->seed[2] = seed[2]; 56 | data->seed[3] = seed[3]; 57 | } 58 | 59 | // Intermediate chaotic mix - WORD_SIZE * 8 = 64 bytes 60 | u64 mix_arr[ROUNDS] ALIGN(ADAM_ALIGNMENT); 61 | 62 | // Create IV's and initialize chaotic mix 63 | initialize(data->seed, *((u64 *) &data->nonce[0]), data->out, mix_arr); 64 | 65 | // Accumulate set of chaotic seeds 66 | accumulate(data->out, mix_arr, data->chseeds); 67 | 68 | // Diffuse our internal work buffer 69 | diffuse(data->out, mix_arr, *((u64 *) &data->nonce[1])); 70 | 71 | // Apply the chaotic function to the buffer 72 | apply(data->out, data->chseeds); 73 | 74 | // Set index to random starting point 75 | // We do this BEFORE mix() so that the byte used here is replaced 76 | data->buff_idx = data->out[BUF_SIZE - 1] & (BUF_SIZE - 1); 77 | 78 | // Mix buffer one last time before it's ready for use! 79 | mix(data->out, mix_arr); 80 | 81 | return 0; 82 | } 83 | 84 | int adam_record(adam_data_t data, u64 *seed, u32 *nonce) 85 | { 86 | MEMCPY(seed, data->seed, ADAM_SEED_SIZE); 87 | MEMCPY(nonce, data->nonce, ADAM_NONCE_SIZE); 88 | return 0; 89 | } 90 | 91 | u128 adam_int(adam_data_t data, const AdamNumWidth width) 92 | { 93 | #define WIDTH_MASK(w) ((((1ULL << ((w << 3) - 1)) - 1) << 1) | 1) 94 | 95 | const u64 num = generate(data->out, &data->buff_idx, data->chseeds); 96 | 97 | if (width == ADAM_GEN_UINT128) { 98 | return ((u128) num << 64) | generate(data->out, &data->buff_idx, data->chseeds); 99 | } 100 | 101 | return num & WIDTH_MASK(width); 102 | } 103 | 104 | double adam_dbl(adam_data_t data, const u64 scale) 105 | { 106 | return (double) (scale + !scale) * ((double) adam_int(data, ADAM_GEN_UINT64) / (double) __UINT64_MAX__); 107 | } 108 | 109 | int adam_fill(adam_data_t data, void *buf, const AdamNumWidth width, const size_t amount) 110 | { 111 | if (!amount || amount > ADAM_FILL_MAX) { 112 | return 1; 113 | } 114 | 115 | const size_t total = amount * width; 116 | 117 | register size_t written = 0; 118 | 119 | u8 *_ptr = (u8 *) buf; 120 | u64 tmp; 121 | 122 | while (total - written >= ADAM_WORD_SIZE) { 123 | tmp = adam_int(data, ADAM_GEN_UINT64); 124 | MEMCPY(&_ptr[written], &tmp, ADAM_WORD_SIZE); 125 | written += ADAM_WORD_SIZE; 126 | } 127 | 128 | if (total - written > 0) { 129 | tmp = adam_int(data, ADAM_GEN_UINT64); 130 | MEMCPY(&_ptr[written], &tmp, total - written); 131 | } 132 | 133 | return 0; 134 | } 135 | 136 | int adam_dfill(adam_data_t data, double *buf, const u64 multiplier, const size_t amount) 137 | { 138 | if (!amount || amount > ADAM_FILL_MAX) { 139 | return 1; 140 | } 141 | 142 | const double mult = multiplier + !multiplier; 143 | 144 | register size_t count = 0; 145 | 146 | do { 147 | buf[count] = mult * ((double) adam_int(data, ADAM_GEN_UINT64) / (double) __UINT64_MAX__); 148 | } while (++count < amount); 149 | 150 | return 0; 151 | } 152 | 153 | void *adam_choice(adam_data_t data, void *arr, const size_t size) 154 | { 155 | return &arr[adam_int(data, ADAM_GEN_UINT64) % size]; 156 | } 157 | 158 | size_t adam_stream(adam_data_t data, const size_t amount, const char *file_name) 159 | { 160 | if (amount < ADAM_WORD_BITS) { 161 | return 0; 162 | } 163 | 164 | if (file_name != NULL) { 165 | freopen(file_name, "wb+", stdout); 166 | } 167 | 168 | register size_t written = 0; 169 | u64 tmp; 170 | while (amount - written >= ADAM_WORD_BITS) { 171 | tmp = adam_int(data, ADAM_GEN_UINT64); 172 | fwrite(&tmp, ADAM_WORD_SIZE, 1, stdout); 173 | written += ADAM_WORD_BITS; 174 | } 175 | 176 | return written; 177 | } 178 | 179 | void adam_cleanup(adam_data_t data) 180 | { 181 | MEMSET(data, 0, sizeof(*data)); 182 | free(data); 183 | } 184 | -------------------------------------------------------------------------------- /src/rng.c: -------------------------------------------------------------------------------- 1 | #include "../include/rng.h" 2 | #include "../include/simd.h" 3 | 4 | // clang-format off 5 | // For diffusion - from https://burtleburtle.net/bob/c/isaac64.c 6 | #define ISAAC_MIX(a,b,c,d,e,f,g,h) { \ 7 | a-=e; f^=h>>9; h+=a; \ 8 | b-=f; g^=a<<9; a+=b; \ 9 | c-=g; h^=b>>23; b+=c; \ 10 | d-=h; a^=c<<15; c+=d; \ 11 | e-=a; b^=d>>14; d+=e; \ 12 | f-=b; c^=e<<20; e+=f; \ 13 | g-=c; d^=f>>17; f+=g; \ 14 | h-=d; e^=g<<14; g+=h; \ 15 | } 16 | // clang-format on 17 | 18 | /* ALGORITHM START */ 19 | 20 | void initialize(const u64 *restrict seed, const u64 nonce, u64 *restrict out, u64 *restrict mix) 21 | { 22 | /* 23 | 8 64-bit IV's that correspond to the verse: 24 | "Be fruitful and multiply, and replenish the earth (Genesis 1:28)" 25 | 26 | Mix IV's with different configurations of seed values 27 | */ 28 | out[0] = 0x4265206672756974 ^ seed[0]; 29 | out[1] = 0x66756C20616E6420 ^ ((seed[1] << (nonce & 63)) | (seed[3] >> (64 - (nonce & 63)))); 30 | out[2] = 0x6D756C7469706C79 ^ seed[1]; 31 | out[3] = 0x2C20616E64207265 ^ ((seed[0] << 32) | (seed[2] >> 32)); 32 | out[4] = 0x706C656E69736820 ^ seed[2]; 33 | out[5] = 0x7468652065617274 ^ ((seed[2] << (nonce & 63)) | (seed[0] >> (64 - (nonce & 63)))); 34 | out[6] = 0x68202847656E6573 ^ seed[3]; 35 | out[7] = 0x697320313A323829 ^ ((seed[3] << 32) | (seed[1] >> 32)); 36 | 37 | // Initialize intermediate chaotic mix 38 | mix[0] = ~out[4] ^ nonce; 39 | mix[1] = ~out[5] ^ (nonce + 1); 40 | mix[2] = ~out[6] ^ (nonce + 2); 41 | mix[3] = ~out[7] ^ (nonce + 3); 42 | mix[4] = ~out[0] ^ (nonce + 4); 43 | mix[5] = ~out[1] ^ (nonce + 5); 44 | mix[6] = ~out[2] ^ (nonce + 6); 45 | mix[7] = ~out[3] ^ (nonce + 7); 46 | } 47 | 48 | void accumulate(u64 *restrict out, u64 *restrict mix, double *restrict chseeds) 49 | { 50 | register u8 i = 0; 51 | 52 | // Scramble 53 | for (; i < ROUNDS; ++i) { 54 | ISAAC_MIX(mix[0], mix[1], mix[2], mix[3], mix[4], mix[5], mix[6], mix[7]); 55 | } 56 | 57 | i = 0; 58 | 59 | const reg64q4 mr = SIMD_LOAD64x4(mix); 60 | reg64q4 r1 = SIMD_LOAD64x4(out); 61 | reg64q4 r2; 62 | 63 | do { 64 | SIMD_XAR64RQ(r2, r1, mr, 32); 65 | SIMD_ADD4RQ64(r1, r1, r2); 66 | } while (++i < ROUNDS); 67 | 68 | const dregq range = SIMD_SETQPD(RANGE_LIMIT); 69 | dreg4q seeds; 70 | SIMD_CAST4QPD(seeds, r2); 71 | SIMD_MUL4QPD(seeds, seeds, range); 72 | SIMD_STORE4PD(chseeds, seeds); 73 | 74 | SIMD_STORE64x4(mix, r1); 75 | } 76 | 77 | void diffuse(u64 *restrict out, u64 *restrict mix, const u64 nonce) 78 | { 79 | register u16 i = 0; 80 | 81 | do { 82 | mix[0] += nonce; 83 | mix[1] += nonce; 84 | mix[2] += nonce; 85 | mix[3] += nonce; 86 | mix[4] += nonce; 87 | mix[5] += nonce; 88 | mix[6] += nonce; 89 | mix[7] += nonce; 90 | 91 | ISAAC_MIX(mix[0], mix[1], mix[2], mix[3], mix[4], mix[5], mix[6], mix[7]); 92 | 93 | out[i + 0] = mix[0]; 94 | out[i + 1] = mix[1]; 95 | out[i + 2] = mix[2]; 96 | out[i + 3] = mix[3]; 97 | out[i + 4] = mix[4]; 98 | out[i + 5] = mix[5]; 99 | out[i + 6] = mix[6]; 100 | out[i + 7] = mix[7]; 101 | } while ((i += 8) < BUF_SIZE); 102 | } 103 | 104 | void apply(u64 *restrict out, double *restrict chseeds) 105 | { 106 | register u16 i = 0; 107 | 108 | const dregq one = SIMD_SETQPD(1.0); 109 | const dregq coeff = SIMD_SETQPD(COEFFICIENT); 110 | const reg64q mask = SIMD_SETQ64(0xFFFFFFFFFFFFF); // 2^52 bits 111 | 112 | reg64q4 r1, r2; 113 | 114 | // Load 8 consecutive seeds at a time 115 | dreg4q d1 = SIMD_LOAD4PD(chseeds); 116 | dreg4q d2; 117 | 118 | do { 119 | // 3.9999 * X * (1 - X) for all X in the register 120 | SIMD_SUB4QPD(d2, one, d1); 121 | SIMD_MUL4QPD(d2, d2, coeff); 122 | SIMD_MUL4RQPD(d1, d1, d2); 123 | 124 | // Load data at current offset 125 | r1 = SIMD_LOAD64x4(&out[i]); 126 | 127 | // Reinterpret results of d1 as binary floating point 128 | // Add the mantissa value to r1 129 | SIMD_REINTERP_ADD64(r2, d1, r1); 130 | 131 | // Store 132 | SIMD_STORE64x4(&out[i], r1); 133 | } while ((i += 8) < BUF_SIZE); 134 | 135 | SIMD_STORE4PD(chseeds, d1); 136 | } 137 | 138 | void mix(u64 *restrict out, const u64 *restrict mix) 139 | { 140 | register u16 i = 0; 141 | 142 | reg64q4 mr = SIMD_LOAD64x4(mix); 143 | reg64q4 r1, r2; 144 | 145 | do { 146 | r1 = SIMD_LOAD64x4(&out[i]); 147 | SIMD_XAR64RQ(r2, r1, mr, 32); 148 | SIMD_ADD4RQ64(mr, mr, r1); 149 | SIMD_3XOR4Q64(r1, r2, mr); 150 | SIMD_STORE64x4(&out[i], r1); 151 | } while ((i += 8) < BUF_SIZE); 152 | } 153 | 154 | u64 generate(u64 *restrict out, u8 *restrict idx, double *restrict chseeds) 155 | { 156 | chseeds[*idx & 7] = CHFUNCTION(*idx, chseeds); 157 | const u64 m = (u64) CHMANT32(*idx, chseeds) << 32; 158 | chseeds[*idx & 7] = CHFUNCTION(*idx, chseeds); 159 | 160 | const u8 offset = out[*idx] & 0x7F; 161 | const u8 a = *idx + 1 + offset; 162 | const u8 b = *idx + 128 + offset; 163 | 164 | const u64 num = out[a] ^ out[b] ^ (m | CHMANT32(*idx, chseeds)); 165 | out[*idx] ^= out[a] ^ out[b]; 166 | 167 | *idx += 1; 168 | 169 | return num; 170 | } 171 | 172 | /* ALGORITHM END */ 173 | -------------------------------------------------------------------------------- /tests/gjrand-10MDBL.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCPF version 13 --small ***** 3 | 4 | 5 | 6 | ============ 7 | tri 1/1 (10485760 doubles) 8 | ======= 9 | blocksize = 64 10 | lo var 0.86344; skew 0.93; m5 0.95633; 11 | mid var -0.85243; skew 1.8621; m5 1.2334; 12 | hi var -0.10047; skew -1.6688; m5 -1.0184; 13 | blocksize = 256 14 | lo var -0.17901; skew 0.98887; m5 0.84376; 15 | mid var -1.1494; skew 1.8318; m5 0.94043; 16 | hi var -0.31932; skew -1.5632; m5 -0.34172; 17 | blocksize = 1024 18 | lo var 0.69569; skew 2.1559; m5 2.7578; 19 | mid var 0.3422; skew 0.96662; m5 0.61324; 20 | hi var -0.51271; skew -2.5037; m5 -2.2925; 21 | blocksize = 4096 22 | lo var 1.8738; skew 1.1861; m5 0.75317; mean 0.86517; 23 | mid var -0.6669; skew 1.3708; m5 1.4087; mean 1.1966; 24 | hi var -1.2071; skew -2.5057; m5 -2.2572; mean -2.0618; 25 | 26 | processed 1e+07 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 27 | 28 | one sided P value (very small numbers are bad) 29 | P = 0.204 30 | ... after 1 tests running guess [p] = 0.2 31 | 32 | 33 | ============ 34 | nda8 1/1 (10485760 doubles) 35 | ======= 36 | extreme = 0.000166 (15 12 48 +) 37 | transform = 4.03 (f e 12) 38 | pvals (0.87 0.5) 39 | 40 | processed 1e+07 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 41 | 42 | one sided P value (very small numbers are bad) 43 | P = 0.75 44 | ... after 2 tests running guess [p] = 0.37 45 | 46 | 47 | ============ 48 | nda4 1/1 (10485760 doubles) 49 | ======= 50 | extreme = 6.17e-05 (2 15 41 -) 51 | transform = 3.9 (3 2 36) 52 | pvals (0.531 0.691) 53 | 54 | processed 1e+07 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 55 | 56 | one sided P value (very small numbers are bad) 57 | P = 0.78 58 | ... after 3 tests running guess [p] = 0.5 59 | 60 | 61 | ============ 62 | rda 1/2 (5242880 doubles) 63 | ======= 64 | simple 65 | chis = 10083 (p = 0.273) 66 | extreme = 1.76e-05 (7975 +) (p = 0.162) 67 | zero1st = 0.00204 (2033 -) (p = 1) 68 | ext = 555 ; exk = 107 ; expect = 143 69 | 70 | zero1st 71 | zero1st = 0.00209 (1707 +) (p = 1) 72 | ext = 588 ; exk = 167 ; expect = 130 73 | 74 | 75 | processed 5.2e+06 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 76 | 77 | one sided P value (very small numbers are bad) 78 | P = 0.506 79 | ... after 4 tests running guess [p] = 0.6 80 | 81 | 82 | ============ 83 | dim3 1/3 (3495253 doubles) 84 | ======= 85 | counts = 1.27284 sigma (p = 0.203) 86 | count = 4.57273 sigma (p = 0.716) (transformed) 87 | sums = 0.51664 sigma (p = 0.605) 88 | sum = 4.90601 sigma (p = 0.216) (transformed) 89 | abs = 1.87602 sigma (p = 0.0607) 90 | abs = 4.77488 sigma (p = 0.376) (transformed) 91 | 92 | processed 3.5e+06 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 93 | 94 | one sided P value (very small numbers are bad) 95 | P = 0.313 96 | ... after 5 tests running guess [p] = 0.68 97 | 98 | 99 | ============ 100 | dim56 1/4 (2621440 doubles) 101 | ======= 102 | sum 1 = 4.78407 sigma (p = 0.363) (transformed) 103 | abs 1 = 4.67606 sigma (p = 0.535) (transformed) 104 | sum 2 = 4.63479 sigma (p = 0.608) (transformed) 105 | abs 2 = 4.98710 sigma (p = 0.148) (transformed) 106 | 107 | processed 2.6e+06 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 108 | 109 | one sided P value (very small numbers are bad) 110 | P = 0.474 111 | ... after 6 tests running guess [p] = 0.75 112 | 113 | 114 | ============ 115 | diff10 1/4 (2621440 doubles) 116 | ======= 117 | order = 0 : chis = 16072 ; p = 0.0839531 118 | order = 1 : chis = 16263 ; p = 0.50736 119 | order = 2 : chis = 16242 ; p = 0.436861 120 | order = 3 : chis = 16268 ; p = 0.52711 121 | order = 4 : chis = 16234 ; p = 0.410308 122 | order = 5 : chis = 16374 ; p = 0.961071 123 | order = 6 : chis = 16450 ; p = 0.708399 124 | order = 7 : chis = 16423 ; p = 0.823991 125 | order = 8 : chis = 16482 ; p = 0.581245 126 | order = 9 : chis = 16217 ; p = 0.35905 127 | 128 | processed 2.6e+06 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 129 | 130 | one sided P value (very small numbers are bad) 131 | P = 0.584 132 | ... after 7 tests running guess [p] = 0.8 133 | 134 | 135 | ============ 136 | diff3 1/8 (1310720 doubles) 137 | ======= 138 | chis = 4164 (0.447049) 139 | chis = 3994 (0.265699) 140 | chis = 4075 (0.826627) 141 | chis = 4248 (0.0933673) 142 | chis = 4109 (0.872427) 143 | chis = 3991 (0.250795) 144 | chis = 4053 (0.649193) 145 | chis = 3984 (0.219777) 146 | chis = 4217 (0.178522) 147 | chis = 4056 (0.673788) 148 | chis = 4052 (0.64153) 149 | 150 | processed 1.3e+06 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 151 | 152 | one sided P value (very small numbers are bad) 153 | P = 0.66 154 | ... after 8 tests running guess [p] = 0.84 155 | 156 | 157 | ============ 158 | chi 1/32 (327680 doubles) 159 | ======= 160 | expected range [ 191 205 227 284 310 331 ] 161 | 267.62969 162 | 265.72344 163 | 241.28750 164 | 257.11094 165 | 238.74531 166 | 259.00156 167 | 168 | processed 3.3e+05 numbers in 0 seconds. Fri Feb 16 22:13:05 2024 169 | 170 | one sided P value (very small numbers are bad) 171 | P = 0.98 172 | 173 | 174 | ==================== 175 | completed 9 tests 176 | 9 out of 9 tests ok. 177 | 178 | 179 | Overall summary one sided P-value (smaller numbers bad) 180 | P = 0.872 : ok -------------------------------------------------------------------------------- /tests/gjrand-100MDBL.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCPF version 13 --standard ***** 3 | 4 | 5 | 6 | ============ 7 | tri 1/1 (104857600 doubles) 8 | ======= 9 | blocksize = 64 10 | lo var 0.58565; skew -0.1819; m5 -0.46154; 11 | mid var 2.6051; skew 0.14782; m5 0.12928; 12 | hi var 1.506; skew 0.029796; m5 0.1948; 13 | blocksize = 256 14 | lo var 0.56374; skew 0.045512; m5 -1.0037; 15 | mid var 1.1371; skew -0.67907; m5 -0.86066; 16 | hi var 0.94203; skew -0.42585; m5 0.25395; 17 | blocksize = 1024 18 | lo var -0.42852; skew 0.77522; m5 0.35464; 19 | mid var 2.2588; skew -0.53912; m5 -0.39883; 20 | hi var 0.67888; skew -0.45809; m5 0.42674; 21 | blocksize = 4096 22 | lo var 0.13998; skew 0.90704; m5 0.89347; mean 0.81718; 23 | mid var 0.44447; skew -0.2128; m5 -0.045767; mean -0.059524; 24 | hi var 1.5558; skew -1.2167; m5 -1.2002; mean -0.75765; 25 | 26 | processed 1e+08 numbers in 0 seconds. Fri Feb 16 22:27:29 2024 27 | 28 | one sided P value (very small numbers are bad) 29 | P = 0.302 30 | ... after 1 tests running guess [p] = 0.3 31 | 32 | 33 | ============ 34 | nda8 1/1 (104857600 doubles) 35 | ======= 36 | extreme = 5.68e-06 (1 5 23 +) 37 | transform = 3.98 (3 b 40) 38 | pvals (0.0674 0.573) 39 | 40 | processed 1e+08 numbers in 0 seconds. Fri Feb 16 22:27:29 2024 41 | 42 | one sided P value (very small numbers are bad) 43 | P = 0.13 44 | ... after 2 tests running guess [p] = 0.24 45 | 46 | 47 | ============ 48 | nda4 1/1 (104857600 doubles) 49 | ======= 50 | extreme = 0.000434 (14 5 5 +) 51 | transform = 3.93 (e 1 23) 52 | pvals (0.995 0.651) 53 | 54 | processed 1e+08 numbers in 1 seconds. Fri Feb 16 22:27:30 2024 55 | 56 | one sided P value (very small numbers are bad) 57 | P = 0.878 58 | ... after 3 tests running guess [p] = 0.34 59 | 60 | 61 | ============ 62 | rda 1/2 (52428800 doubles) 63 | ======= 64 | simple 65 | chis = 10112 (p = 0.21) 66 | extreme = 1.85e-05 (953 +) (p = 0.169) 67 | zero1st = 0.000771 (771 -) (p = 1) 68 | ext = 6974 ; exk = 654 ; expect = 744 69 | 70 | zero1st 71 | zero1st = 0.000698 (2156 +) (p = 0.999) 72 | ext = 5572 ; exk = 1642 ; expect = 1.51e+03 73 | 74 | 75 | processed 5.2e+07 numbers in 0 seconds. Fri Feb 16 22:27:30 2024 76 | 77 | one sided P value (very small numbers are bad) 78 | P = 0.523 79 | ... after 4 tests running guess [p] = 0.43 80 | 81 | 82 | ============ 83 | dim3 1/3 (34952533 doubles) 84 | ======= 85 | counts = 0.36224 sigma (p = 0.717) 86 | count = 4.92095 sigma (p = 0.202) (transformed) 87 | sums = 0.46868 sigma (p = 0.639) 88 | sum = 4.60881 sigma (p = 0.654) (transformed) 89 | abs = 0.89701 sigma (p = 0.37) 90 | abs = 4.82381 sigma (p = 0.309) (transformed) 91 | 92 | processed 3.5e+07 numbers in 0 seconds. Fri Feb 16 22:27:30 2024 93 | 94 | one sided P value (very small numbers are bad) 95 | P = 0.741 96 | ... after 5 tests running guess [p] = 0.5 97 | 98 | 99 | ============ 100 | dim56 1/4 (26214400 doubles) 101 | ======= 102 | sum 1 = 4.46476 sigma (p = 0.878) (transformed) 103 | abs 1 = 5.05091 sigma (p = 0.109) (transformed) 104 | sum 2 = 4.99833 sigma (p = 0.141) (transformed) 105 | abs 2 = 4.60803 sigma (p = 0.655) (transformed) 106 | 107 | processed 2.6e+07 numbers in 0 seconds. Fri Feb 16 22:27:30 2024 108 | 109 | one sided P value (very small numbers are bad) 110 | P = 0.369 111 | ... after 6 tests running guess [p] = 0.57 112 | 113 | 114 | ============ 115 | dim155 1/4 (26214400 doubles) 116 | ======= 117 | count weight = 7 idx = 302033 p = 0.286 (transformed) 118 | sum weight = 7 idx = 0ee040 p = 0.515 (transformed) 119 | abs weight = 7 idx = 1006a5 p = 0.904 (transformed) 120 | 121 | processed 2.6e+07 numbers in 1 seconds. Fri Feb 16 22:27:31 2024 122 | 123 | one sided P value (very small numbers are bad) 124 | P = 0.636 125 | ... after 7 tests running guess [p] = 0.62 126 | 127 | 128 | ============ 129 | diff10 1/4 (26214400 doubles) 130 | ======= 131 | order = 0 : chis = 16434 ; p = 0.776488 132 | order = 1 : chis = 16761 ; p = 0.0378879 133 | order = 2 : chis = 16340 ; p = 0.81385 134 | order = 3 : chis = 16340 ; p = 0.816267 135 | order = 4 : chis = 16693 ; p = 0.088204 136 | order = 5 : chis = 16518 ; p = 0.45542 137 | order = 6 : chis = 16371 ; p = 0.949623 138 | order = 7 : chis = 16696 ; p = 0.0851071 139 | order = 8 : chis = 16383 ; p = 0.998825 140 | order = 9 : chis = 16300 ; p = 0.648063 141 | 142 | processed 2.6e+07 numbers in 1 seconds. Fri Feb 16 22:27:32 2024 143 | 144 | one sided P value (very small numbers are bad) 145 | P = 0.32 146 | ... after 8 tests running guess [p] = 0.67 147 | 148 | 149 | ============ 150 | diff3 1/8 (13107200 doubles) 151 | ======= 152 | chis = 4189 (0.297102) 153 | chis = 3925 (0.0575039) 154 | chis = 3867 (0.0103338) 155 | chis = 4119 (0.783247) 156 | chis = 4078 (0.857212) 157 | chis = 3997 (0.278068) 158 | chis = 4097 (0.976049) 159 | chis = 4093 (0.992066) 160 | chis = 4179 (0.355182) 161 | chis = 4135 (0.656504) 162 | chis = 4072 (0.805849) 163 | 164 | processed 1.3e+07 numbers in 0 seconds. Fri Feb 16 22:27:32 2024 165 | 166 | one sided P value (very small numbers are bad) 167 | P = 0.108 168 | ... after 9 tests running guess [p] = 0.64 169 | 170 | 171 | ============ 172 | chi 1/32 (3276800 doubles) 173 | ======= 174 | expected range [ 191 205 227 284 310 331 ] 175 | 225.45672 176 | 236.57609 177 | 298.71984 178 | 265.13625 179 | 273.45984 180 | 304.83219 181 | 182 | processed 3.3e+06 numbers in 0 seconds. Fri Feb 16 22:27:32 2024 183 | 184 | one sided P value (very small numbers are bad) 185 | P = 0.193 186 | 187 | 188 | ==================== 189 | completed 10 tests 190 | 10 out of 10 tests ok. 191 | 192 | 193 | Overall summary one sided P-value (smaller numbers bad) 194 | P = 0.681 : ok -------------------------------------------------------------------------------- /tests/gjrand-1BDBL.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCPF version 13 --big ***** 3 | 4 | 5 | 6 | ============ 7 | tri 1/1 (1073741824 doubles) 8 | ======= 9 | blocksize = 64 10 | lo var 0.033564; skew -0.94623; m5 -0.089332; 11 | mid var -0.1459; skew 1.0634; m5 0.6049; 12 | hi var 1.4213; skew 0.54424; m5 0.9188; 13 | blocksize = 256 14 | lo var 0.66224; skew -0.54071; m5 0.21259; 15 | mid var 1.2358; skew 0.37714; m5 -0.53735; 16 | hi var 0.61572; skew -0.26776; m5 -0.10936; 17 | blocksize = 1024 18 | lo var -0.61641; skew -1.2399; m5 -0.3915; 19 | mid var 0.40702; skew 0.55737; m5 -0.32598; 20 | hi var 0.41155; skew 0.093443; m5 0.74589; 21 | blocksize = 4096 22 | lo var -0.42911; skew -1.6251; m5 -0.81631; mean -1.8002; 23 | mid var -0.47263; skew 1.2965; m5 1.0727; mean 1.3153; 24 | hi var -1.5555; skew 0.24142; m5 -0.21706; mean 0.48486; 25 | 26 | processed 1.1e+09 numbers in 4 seconds. Tue Mar 19 11:19:07 2024 27 | 28 | one sided P value (very small numbers are bad) 29 | P = 0.945 30 | ... after 1 tests running guess [p] = 0.94 31 | 32 | 33 | ============ 34 | nda8 1/1 (1073741824 doubles) 35 | ======= 36 | extreme = 5.02e-05 (15 3 36 +) 37 | transform = 4.3 (d 5 32) 38 | pvals (0.461 0.191) 39 | 40 | processed 1.1e+09 numbers in 4 seconds. Tue Mar 19 11:19:11 2024 41 | 42 | one sided P value (very small numbers are bad) 43 | P = 0.346 44 | ... after 2 tests running guess [p] = 0.57 45 | 46 | 47 | ============ 48 | nda4 1/1 (1073741824 doubles) 49 | ======= 50 | extreme = 5.54e-05 (9 12 25 +) 51 | transform = 4.1 (6 e 15) 52 | pvals (0.494 0.404) 53 | 54 | processed 1.1e+09 numbers in 3 seconds. Tue Mar 19 11:19:14 2024 55 | 56 | one sided P value (very small numbers are bad) 57 | P = 0.645 58 | ... after 3 tests running guess [p] = 0.72 59 | 60 | 61 | ============ 62 | rda 1/2 (536870912 doubles) 63 | ======= 64 | simple 65 | chis = 9994 (p = 0.508) 66 | extreme = 0.00019 (7296 +) (p = 0.85) 67 | zero1st = 0.00079 (1090 -) (p = 1) 68 | ext = 66871 ; exk = 9530 ; expect = 9.86e+03 69 | 70 | zero1st 71 | zero1st = 8.69e-05 (310 -) (p = 0.581) 72 | ext = 75165 ; exk = 3103 ; expect = 3.33e+03 73 | 74 | 75 | processed 5.4e+08 numbers in 1 seconds. Tue Mar 19 11:19:15 2024 76 | 77 | one sided P value (very small numbers are bad) 78 | P = 0.942 79 | ... after 4 tests running guess [p] = 0.82 80 | 81 | 82 | ============ 83 | dim3 1/3 (357913941 doubles) 84 | ======= 85 | counts = -0.22002 sigma (p = 0.826) 86 | count = 4.61350 sigma (p = 0.645) (transformed) 87 | sums = -2.11629 sigma (p = 0.0343) 88 | sum = 4.53589 sigma (p = 0.778) (transformed) 89 | abs = -1.52547 sigma (p = 0.127) 90 | abs = 4.95036 sigma (p = 0.176) (transformed) 91 | 92 | processed 3.6e+08 numbers in 1 seconds. Tue Mar 19 11:19:16 2024 93 | 94 | one sided P value (very small numbers are bad) 95 | P = 0.189 96 | ... after 5 tests running guess [p] = 0.65 97 | 98 | 99 | ============ 100 | dim56 1/4 (268435456 doubles) 101 | ======= 102 | sum 1 = 4.59186 sigma (p = 0.684) (transformed) 103 | abs 1 = 5.23483 sigma (p = 0.0424) (transformed) 104 | sum 2 = 4.44927 sigma (p = 0.896) (transformed) 105 | abs 2 = 4.77020 sigma (p = 0.383) (transformed) 106 | 107 | processed 2.7e+08 numbers in 1 seconds. Tue Mar 19 11:19:17 2024 108 | 109 | one sided P value (very small numbers are bad) 110 | P = 0.159 111 | ... after 6 tests running guess [p] = 0.65 112 | 113 | 114 | ============ 115 | dim155 1/4 (268435456 doubles) 116 | ======= 117 | counts = -0.03403 sigma (p = 0.973) 118 | count weight = 9 idx = 3d1e35 p = 0.528 (transformed) 119 | sums = 0.63022 sigma (p = 0.529) 120 | sum weight = 4 idx = 050060 p = 0.762 (transformed) 121 | abs = -1.13831 sigma (p = 0.255) 122 | abs weight = 8 idx = 154483 p = 0.491 (transformed) 123 | 124 | processed 2.7e+08 numbers in 2 seconds. Tue Mar 19 11:19:19 2024 125 | 126 | one sided P value (very small numbers are bad) 127 | P = 0.829 128 | ... after 7 tests running guess [p] = 0.7 129 | 130 | 131 | ============ 132 | diff10 1/4 (268435456 doubles) 133 | ======= 134 | order = 0 : chis = 16284 ; p = 0.584779 135 | order = 1 : chis = 16389 ; p = 0.970632 136 | order = 2 : chis = 16392 ; p = 0.957273 137 | order = 3 : chis = 16286 ; p = 0.594898 138 | order = 4 : chis = 16232 ; p = 0.405463 139 | order = 5 : chis = 16448 ; p = 0.715708 140 | order = 6 : chis = 16324 ; p = 0.746715 141 | order = 7 : chis = 16162 ; p = 0.221642 142 | order = 8 : chis = 16407 ; p = 0.89339 143 | order = 9 : chis = 16570 ; p = 0.302133 144 | 145 | processed 2.7e+08 numbers in 4 seconds. Tue Mar 19 11:19:23 2024 146 | 147 | one sided P value (very small numbers are bad) 148 | P = 0.918 149 | ... after 8 tests running guess [p] = 0.75 150 | 151 | 152 | ============ 153 | diff3 1/8 (134217728 doubles) 154 | ======= 155 | chis = 4102 (0.934137) 156 | chis = 4301 (0.0248539) 157 | chis = 4101 (0.939293) 158 | chis = 4012 (0.361745) 159 | chis = 3928 (0.0616732) 160 | chis = 4138 (0.631286) 161 | chis = 4188 (0.302522) 162 | chis = 4332 (0.00990547) 163 | chis = 4015 (0.374837) 164 | chis = 4183 (0.333044) 165 | chis = 4167 (0.422107) 166 | 167 | processed 1.3e+08 numbers in 3 seconds. Tue Mar 19 11:19:26 2024 168 | 169 | one sided P value (very small numbers are bad) 170 | P = 0.104 171 | ... after 9 tests running guess [p] = 0.63 172 | 173 | 174 | ============ 175 | chi 1/32 (33554432 doubles) 176 | ======= 177 | expected range [ 191 205 227 284 310 331 ] 178 | 236.91492 179 | 250.39952 180 | 272.24924 181 | 240.48233 182 | 272.80807 183 | 260.65926 184 | 185 | processed 3.4e+07 numbers in 0 seconds. Tue Mar 19 11:19:26 2024 186 | 187 | one sided P value (very small numbers are bad) 188 | P = 0.963 189 | 190 | 191 | ==================== 192 | completed 10 tests 193 | 10 out of 10 tests ok. 194 | 195 | 196 | Overall summary one sided P-value (smaller numbers bad) 197 | P = 0.667 : ok -------------------------------------------------------------------------------- /tests/gjrand-10BDBL.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCPF version 13 --huge ***** 3 | 4 | 5 | 6 | ============ 7 | tri 1/1 (10737418240 doubles) 8 | ======= 9 | blocksize = 64 10 | lo var 0.066306; skew -0.82363; m5 -0.7885; 11 | mid var -0.054833; skew -1.7719; m5 -2.3673; 12 | hi var 0.71785; skew 0.72578; m5 0.27247; 13 | blocksize = 256 14 | lo var -1.2391; skew -0.84624; m5 -0.27984; 15 | mid var -0.9634; skew -0.77818; m5 -0.85943; 16 | hi var 0.2255; skew 0.12836; m5 -0.32936; 17 | blocksize = 1024 18 | lo var -1.2715; skew 0.34392; m5 0.89764; 19 | mid var -0.26415; skew 0.1376; m5 0.13817; 20 | hi var -0.010827; skew -0.14046; m5 -0.81255; 21 | blocksize = 4096 22 | lo var 0.16648; skew -1.0746; m5 -1.5244; mean -0.43319; 23 | mid var 0.17982; skew -0.54437; m5 0.34256; mean -0.45417; 24 | hi var 0.85911; skew -0.39937; m5 0.03249; mean 0.88736; 25 | 26 | processed 1.1e+10 numbers in 45 seconds. Tue Mar 19 11:34:03 2024 27 | 28 | one sided P value (very small numbers are bad) 29 | P = 0.506 30 | ... after 1 tests running guess [p] = 0.51 31 | 32 | 33 | ============ 34 | nda8 1/1 (10737418240 doubles) 35 | ======= 36 | extreme = 4.14e-05 (9 7 28 -) 37 | transform = 3.69 (5 d 34) 38 | pvals (0.399 0.934) 39 | 40 | processed 1.1e+10 numbers in 33 seconds. Tue Mar 19 11:34:36 2024 41 | 42 | one sided P value (very small numbers are bad) 43 | P = 0.638 44 | ... after 2 tests running guess [p] = 0.76 45 | 46 | 47 | ============ 48 | nda4 1/1 (10737418240 doubles) 49 | ======= 50 | extreme = 0.000159 (3 6 25 -) 51 | transform = 3.67 (3 8 35) 52 | pvals (0.859 0.95) 53 | 54 | processed 1.1e+10 numbers in 30 seconds. Tue Mar 19 11:35:06 2024 55 | 56 | one sided P value (very small numbers are bad) 57 | P = 0.98 58 | ... after 3 tests running guess [p] = 0.88 59 | 60 | 61 | ============ 62 | rda 1/2 (5368709120 doubles) 63 | ======= 64 | simple 65 | chis = 10174 (p = 0.107) 66 | extreme = 2.25e-05 (5457 -) (p = 0.202) 67 | zero1st = 3.6e-05 (717 -) (p = 0.302) 68 | ext = 708096 ; exk = 69422 ; expect = 7.05e+04 69 | 70 | zero1st 71 | zero1st = 0.0018 (131 +) (p = 1) 72 | ext = 771859 ; exk = 14940 ; expect = 1.46e+04 73 | 74 | 75 | processed 5.4e+09 numbers in 16 seconds. Tue Mar 19 11:35:22 2024 76 | 77 | one sided P value (very small numbers are bad) 78 | P = 0.365 79 | ... after 4 tests running guess [p] = 0.84 80 | 81 | 82 | ============ 83 | dim3 1/3 (3579139413 doubles) 84 | ======= 85 | counts = -1.92808 sigma (p = 0.0538) 86 | count = 4.60391 sigma (p = 0.662) (transformed) 87 | sums = 1.92825 sigma (p = 0.0538) 88 | sum = 4.67200 sigma (p = 0.542) (transformed) 89 | abs = 0.31145 sigma (p = 0.755) 90 | abs = 4.56855 sigma (p = 0.724) (transformed) 91 | 92 | processed 3.6e+09 numbers in 11 seconds. Tue Mar 19 11:35:33 2024 93 | 94 | one sided P value (very small numbers are bad) 95 | P = 0.282 96 | ... after 5 tests running guess [p] = 0.81 97 | 98 | 99 | ============ 100 | dim56 1/4 (2684354560 doubles) 101 | ======= 102 | sum 1 = 4.53580 sigma (p = 0.778) (transformed) 103 | abs 1 = 4.55633 sigma (p = 0.745) (transformed) 104 | sum 2 = 4.98505 sigma (p = 0.15) (transformed) 105 | abs 2 = 4.78237 sigma (p = 0.365) (transformed) 106 | 107 | processed 2.7e+09 numbers in 7 seconds. Tue Mar 19 11:35:40 2024 108 | 109 | one sided P value (very small numbers are bad) 110 | P = 0.478 111 | ... after 6 tests running guess [p] = 0.86 112 | 113 | 114 | ============ 115 | dim155 1/4 (2684354560 doubles) 116 | ======= 117 | counts = -1.99526 sigma (p = 0.046) 118 | count weight = 5 idx = 280406 p = 0.467 (transformed) 119 | sums = -0.98335 sigma (p = 0.325) 120 | sum weight = 2 idx = 004040 p = 0.838 (transformed) 121 | abs = -0.74418 sigma (p = 0.457) 122 | abs weight = 6 idx = 14e002 p = 0.336 (transformed) 123 | 124 | processed 2.7e+09 numbers in 15 seconds. Tue Mar 19 11:35:55 2024 125 | 126 | one sided P value (very small numbers are bad) 127 | P = 0.246 128 | ... after 7 tests running guess [p] = 0.86 129 | 130 | 131 | ============ 132 | diff10 1/4 (2684354560 doubles) 133 | ======= 134 | order = 0 : chis = 16475 ; p = 0.610464 135 | order = 1 : chis = 16422 ; p = 0.828324 136 | order = 2 : chis = 16552 ; p = 0.349538 137 | order = 3 : chis = 16413 ; p = 0.863912 138 | order = 4 : chis = 16434 ; p = 0.774905 139 | order = 5 : chis = 16538 ; p = 0.391366 140 | order = 6 : chis = 16385 ; p = 0.988543 141 | order = 7 : chis = 16555 ; p = 0.341932 142 | order = 8 : chis = 16413 ; p = 0.86588 143 | order = 9 : chis = 16613 ; p = 0.204403 144 | 145 | processed 2.7e+09 numbers in 42 seconds. Tue Mar 19 11:36:38 2024 146 | 147 | one sided P value (very small numbers are bad) 148 | P = 0.898 149 | ... after 8 tests running guess [p] = 0.9 150 | 151 | 152 | ============ 153 | diff3 1/8 (1342177280 doubles) 154 | ======= 155 | chis = 4129 (0.700375) 156 | chis = 4044 (0.57913) 157 | chis = 4149 (0.544791) 158 | chis = 4097 (0.975173) 159 | chis = 4154 (0.512166) 160 | chis = 4144 (0.584536) 161 | chis = 3970 (0.166737) 162 | chis = 4123 (0.753165) 163 | chis = 4078 (0.854794) 164 | chis = 4198 (0.258192) 165 | chis = 4269 (0.0569783) 166 | 167 | processed 1.3e+09 numbers in 35 seconds. Tue Mar 19 11:37:13 2024 168 | 169 | one sided P value (very small numbers are bad) 170 | P = 0.476 171 | ... after 9 tests running guess [p] = 0.92 172 | 173 | 174 | ============ 175 | chi 1/32 (335544320 doubles) 176 | ======= 177 | expected range [ 191 205 227 284 310 331 ] 178 | 254.46137 179 | 246.70636 180 | 254.40922 181 | 278.32713 182 | 218.87376 183 | 223.21463 184 | 185 | processed 3.4e+08 numbers in 1 seconds. Tue Mar 19 11:37:14 2024 186 | 187 | one sided P value (very small numbers are bad) 188 | P = 0.463 189 | 190 | 191 | ==================== 192 | completed 10 tests 193 | 10 out of 10 tests ok. 194 | 195 | 196 | Overall summary one sided P-value (smaller numbers bad) 197 | P = 0.941 : ok -------------------------------------------------------------------------------- /include/api.h: -------------------------------------------------------------------------------- 1 | #ifndef ADAM_API_H 2 | #define ADAM_API_H 3 | #include "defs.h" 4 | 5 | #define ADAM_ALIGNMENT (64) 6 | #define ADAM_WORD_BITS (64) 7 | #define ADAM_WORD_SIZE (ADAM_WORD_BITS >> 3) 8 | #define ADAM_SEED_SIZE (ADAM_WORD_SIZE * 4) 9 | #define ADAM_NONCE_SIZE (sizeof(u32) * 3) 10 | #define ADAM_FILL_MAX (1000000000) 11 | 12 | typedef struct adam_data_s * adam_data_t; 13 | 14 | typedef enum { 15 | ADAM_GEN_UINT8 = 1, 16 | ADAM_GEN_UINT16 = 2, 17 | ADAM_GEN_UINT32 = 4, 18 | ADAM_GEN_UINT64 = 8, 19 | ADAM_GEN_UINT128 = 16 20 | } AdamNumWidth; 21 | 22 | /* 23 | Configures ADAM's initial state by allocating the adam_data_t 24 | struct and preparing it for random generation. 25 | 26 | Call this ONCE at the start of your program, before generating 27 | any numbers. 28 | 29 | Params and are optional - set to NULL if you'd like 30 | to seed the generator with secure random bytes from the operating 31 | system itself. Otherwise, the caller must ensure that points 32 | to 256 bits of data [u64; 4], and that nonce points to 96 bits [u32; 3]. 33 | 34 | Returns an opaque pointer to the internal adam_data_s struct. Make 35 | sure you remember to adam_cleanup() once you no longer need it! 36 | */ 37 | adam_data_t adam_setup(u64 *seed, u32 *nonce); 38 | 39 | /* 40 | Resets and reconstructs ADAM's internal state based on a new 41 | and . 42 | 43 | If provided, the caller must ensure that points to 256 bits 44 | of data [u64; 4], and that nonce points to 96 bits [u32; 3]. If they 45 | do not, then the program is ill-formed. 46 | 47 | Returns 0 on success. 48 | */ 49 | int adam_reset(adam_data_t data, u64 *seed, u32 *nonce); 50 | 51 | /* 52 | Save the current seed and nonce, if you didn't set it yourself and 53 | would like to record the parameters. 54 | 55 | The caller must ensure that points to 256 bits of data 56 | [u64; 4], and that nonce points to 96 bits [u32; 3]. If they do 57 | not, then the program is ill-formed. 58 | 59 | Returns 0 on success. 60 | */ 61 | int adam_record(adam_data_t data, u64 *seed, u32 *nonce); 62 | 63 | /* 64 | Returns a random unsigned integer guaranteed to have less than or 65 | equal to the number of bits specified in . So despite this 66 | function returning a u128, you can safely cast it to whatever 67 | UNSIGNED integer type you want. 68 | 69 | Param must ALWAYS be a member of the AdamNumWidth enum. Other 70 | arbitrary values will probably result in undefined behavior or a 71 | seg fault. Your program is ill-formed if other values are passed! 72 | 73 | For 128-bit output, since ADAM can natively only output 64-bits at a 74 | time, this function will advance the internal state of ADAM twice, 75 | meaning that it's the same as left shifting and OR-ing two 64-bit 76 | results to form an output value. 77 | */ 78 | u128 adam_int(adam_data_t data, const AdamNumWidth width); 79 | 80 | /* 81 | Returns a random double after multiplying it by param . 82 | 83 | For no scaling factor, just set to 1. Also, a value 84 | of 0 is ignored and treated as 1. 85 | */ 86 | double adam_dbl(adam_data_t data, const u64 scale); 87 | 88 | /* 89 | Fills a given buffer with random integers. 90 | 91 | The caller is responsible for ensuring param is of at least 92 | * sizeof(u64) bytes in length, and that the pointer is not 93 | NULL. If is 0 or greater than 1 billion, this function 94 | will return 1 and exit. 95 | 96 | Param must ALWAYS be a member of the AdamNumWidth enum. Other 97 | arbitrary values will probably result in undefined behavior or a 98 | seg fault. Your program is ill-formed if other values are passed! 99 | 100 | Returns 0 on success, 1 on error. 101 | */ 102 | int adam_fill(adam_data_t data, void *buf, const AdamNumWidth width, const size_t amount); 103 | 104 | /* 105 | Fills a given buffer with random doubles. 106 | 107 | The caller is responsible for ensuring param is of at least 108 | * sizeof(double) bytes in length, and that the pointer is 109 | not NULL. If is 0 or greater than 1 billion, this function 110 | will return 1 and exit. 111 | 112 | Param can be supplied to multiply all doubles by a certain 113 | scaling factor so they fall within the range (0, ). If you 114 | do not need a scaling factor, just pass a value of 1 or 0. 115 | 116 | Returns 0 on success, 1 on error. 117 | */ 118 | int adam_dfill(adam_data_t data, double *buf, const u64 multiplier, const size_t amount); 119 | 120 | /* 121 | Chooses a random item from a provided collection, where param is a 122 | pointer to this collection, and param is to specify the total 123 | range of possible indices, usually the full length of the array but you 124 | could pass in a smaller number than that if you want to choose from a 125 | particular range or within a specific radius. 126 | 127 | Caller must guarantee is NEVER larger than the 's capacity. 128 | 129 | Returns a randomly picked member of . 130 | */ 131 | void *adam_choice(adam_data_t data, void *arr, const size_t size); 132 | 133 | /* 134 | Writes param BITS (not bytes!) to a file descriptor of your choice. 135 | 136 | You can pass NULL for param if you'd like to stream to stdout, 137 | rather than an actual file. If you provide a valid file name, then it will 138 | be created and saved with the requested amount of binary data. 139 | 140 | If param is less than 64, this function won't do anything. 141 | 142 | Returns the total number of bits written out, or 0 if invalid value for . 143 | */ 144 | size_t adam_stream(adam_data_t data, const size_t amount, const char *file_name); 145 | 146 | /* 147 | Zeroizes adam_data_t members and frees any allocated memory. 148 | 149 | Call this ONCE after you are finished using the generator. 150 | */ 151 | void adam_cleanup(adam_data_t data); 152 | #endif 153 | -------------------------------------------------------------------------------- /tests/gjrand-10MB.txt: -------------------------------------------------------------------------------- 1 | ***** MCP version 13 --tiny ***** 2 | 3 | ============ 4 | binr -c 1/280 (37449 bytes) 5 | ======= 6 | dim = 128 ; rnk = 128 ; p = 1 7 | dim = 384 ; rnk = 380 ; p = 0.125 8 | done 3 matrices ; largest 384 X 384 9 | 10 | processed in 0 seconds. Mon Nov 27 12:52:06 2023 11 | 12 | one sided P value (very small numbers are bad) 13 | P = 0.33 14 | ... after 1 tests running guess [p] = 0.33 15 | 16 | 17 | ============ 18 | rda 1/1 (10485760 bytes) 19 | ======= 20 | chisquare (df=749) 753 (p = 0.455) 21 | extreme = 0.000622 (310 -) (p = 0.373) 22 | zero1st = 0.00449 (30 +) (p = 0.966) 23 | ext = 36416 ; exk = 4101 ; expect = 3922 24 | 25 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 26 | 27 | one sided P value (very small numbers are bad) 28 | P = 0.754 29 | ... after 2 tests running guess [p] = 0.55 30 | 31 | 32 | ============ 33 | z9 1/1 (10485760 bytes) 34 | ======= 35 | mix3 extreme = 2.50806 (lags = 101) low weight 44 36 | mix3 extreme = 2.98960 (lags = 0000022) medium weight 378 37 | mix3 extreme = 4.19483 (lags = 01022211) high weight 6138 38 | bits per word = 32 : sub-test P value = 0.395 39 | 40 | mix3 extreme = 1.88952 (lags = 01000001) low weight 44 41 | mix3 extreme = 3.01328 (lags = 01010011) medium weight 378 42 | mix3 extreme = 3.96877 (lags = 12200011) high weight 6138 43 | bits per word = 128 : sub-test P value = 0.736 44 | 45 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 46 | 47 | one sided P value (very small numbers are bad) 48 | P = 0.634 49 | ... after 3 tests running guess [p] = 0.7 50 | 51 | 52 | ============ 53 | diff12 1/7 (1497965 bytes) 54 | ======= 55 | order = 0 : chis = 2064 ; p = 0.778337 56 | order = 1 : chis = 2034 ; p = 0.847217 57 | order = 2 : chis = 2123 ; p = 0.237591 58 | order = 3 : chis = 2011 ; p = 0.580124 59 | order = 4 : chis = 2016 ; p = 0.638866 60 | order = 5 : chis = 2017 ; p = 0.643311 61 | order = 6 : chis = 2020 ; p = 0.677785 62 | order = 7 : chis = 1937 ; p = 0.082287 63 | order = 8 : chis = 2126 ; p = 0.216082 64 | order = 9 : chis = 1925 ; p = 0.0534226 65 | order = 10 : chis = 1969 ; p = 0.219902 66 | order = 11 : chis = 1966 ; p = 0.20336 67 | 68 | processed 1.5e+06 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 69 | 70 | one sided P value (very small numbers are bad) 71 | P = 0.483 72 | ... after 4 tests running guess [p] = 0.8 73 | 74 | 75 | ============ 76 | lownda 1/2 (5242880 bytes) 77 | ======= 78 | extreme = 3.51e-05 (13 2 21 -) 79 | transform = 4.03 (e b 13) 80 | pvals (0.35 0.49) 81 | 82 | processed 5.2e+06 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 83 | 84 | one sided P value (very small numbers are bad) 85 | P = 0.578 86 | ... after 5 tests running guess [p] = 0.86 87 | 88 | 89 | ============ 90 | nda 1/28 (374491 bytes) 91 | ======= 92 | extreme = 0.000217 (4 12 16 -) 93 | transform = 3.75 (f d 47) 94 | pvals (0.93 0.888) 95 | 96 | processed 3.7e+05 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 97 | 98 | one sided P value (very small numbers are bad) 99 | P = 0.987 100 | ... after 6 tests running guess [p] = 0.91 101 | 102 | 103 | ============ 104 | v256 1/1 (10485760 bytes) 105 | ======= 106 | minimum = 142 (prob = 0.5632440838 0.8551239826) 107 | maximum = 182 (prob = 0.4989919552 0.8091440887) 108 | 109 | expected range [ 14.0 17.8 23.9 44.9 56.1 65.3 ] 110 | chi-squared = 25.26382 111 | 112 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 113 | 114 | one sided P value (very small numbers are bad) 115 | P = 0.995 116 | ... after 7 tests running guess [p] = 0.94 117 | 118 | 119 | ============ 120 | mod3 1/1 (10485760 bytes) 121 | ======= 122 | chis = 19718.9 ; df = 19682 ; p = 0.42489 123 | mix3 extreme = 4.02635 ; p = 0.52449 124 | 125 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:06 2023 126 | 127 | one sided P value (very small numbers are bad) 128 | P = 0.669 129 | ... after 8 tests running guess [p] = 0.96 130 | 131 | 132 | ============ 133 | selfcor 1/1 (10485760 bytes) 134 | ======= 135 | forward (msb) : mean=-0.003565 ; sd=1.004286 ; ext = -4.542497 (3455) 136 | ==> p = 0.167 137 | reverse (lsb) : mean=-0.003843 ; sd=0.996559 ; ext = 4.137189 (24116) 138 | ==> p = 0.684 139 | 140 | processed 1e+07 bytes in 1 seconds. Mon Nov 27 12:52:07 2023 141 | 142 | one sided P value (very small numbers are bad) 143 | P = 0.305 144 | ... after 9 tests running guess [p] = 0.96 145 | 146 | 147 | ============ 148 | rda16 1/12 (873813 bytes) 149 | ======= 150 | simple 151 | chis = 70141 (p = 0.351) 152 | extreme = 2.3e-05 (21831 +) (p = 0.8) 153 | zero1st = 0.000153 (2 -) (p = 0.859) 154 | ext = 5 ; exk = 0 ; expect = 7.63e-05 155 | 156 | zero1st 157 | zero1st = 0.000153 (2 -) (p = 0.933) 158 | ext = 5 ; exk = 0 ; expect = 7.63e-05 159 | 160 | 161 | processed 6.1e+05 bytes in 0 seconds. Mon Nov 27 12:52:07 2023 162 | 163 | one sided P value (very small numbers are bad) 164 | P = 0.823 165 | ... after 10 tests running guess [p] = 0.97 166 | 167 | 168 | ============ 169 | z9 -t 1/1 (10485760 bytes) 170 | ======= 171 | transitions 172 | mix3 extreme = 2.46004 (lags = 1000001) low weight 44 173 | mix3 extreme = 3.36359 (lags = 02000101) medium weight 378 174 | mix3 extreme = 4.24230 (lags = 2200222) high weight 6138 175 | bits per word = 32 : sub-test P value = 0.335 176 | 177 | mix3 extreme = 2.35547 (lags = 011) low weight 44 178 | mix3 extreme = 3.00025 (lags = 20011) medium weight 378 179 | mix3 extreme = 4.07362 (lags = 0002102) high weight 6138 180 | bits per word = 128 : sub-test P value = 0.574 181 | 182 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:07 2023 183 | 184 | one sided P value (very small numbers are bad) 185 | P = 0.557 186 | ... after 11 tests running guess [p] = 0.98 187 | 188 | 189 | ============ 190 | sh5da 1/1 (10485760 bytes) 191 | ======= 192 | native byte order : (df=364) chis=354.08 p = 0.635 193 | extreme = 0.00193 (148 +) (p = 0.505) 194 | reverse byte order: (df=364) chis=399.08 p = 0.0994 195 | extreme = 0.000752 (231 -) (p = 0.24) 196 | 197 | processed 1e+07 bytes in 0 seconds. Mon Nov 27 12:52:07 2023 198 | 199 | one sided P value (very small numbers are bad) 200 | P = 0.342 201 | ... after 12 tests running guess [p] = 0.99 202 | 203 | 204 | ============ 205 | slicerda 1/3 (3495253 bytes) 206 | ======= 207 | expected range [ 633 662 699 799 841 875 ] 208 | 0 : 703.40746 209 | 2 : 814.56476 210 | 4 : 800.40740 211 | 6 : 743.11632 212 | 8 : 750.99000 213 | 10 : 718.05328 214 | 12 : 733.87538 215 | 14 : 764.71377 216 | 16 : 705.56924 217 | 18 : 796.97640 218 | 20 : 775.30182 219 | 22 : 766.65419 220 | 24 : 761.67447 221 | 26 : 774.23663 222 | 28 : 843.56883 223 | 30 : 817.21198 224 | extreme = 5.31e-05 (30 428 +) 225 | pvals (0.135 0.471) 226 | 227 | processed 3.5e+06 bytes in 0 seconds. Mon Nov 27 12:52:07 2023 228 | 229 | one sided P value (very small numbers are bad) 230 | P = 0.252 231 | 232 | 233 | ==================== 234 | completed 13 tests 235 | 13 out of 13 tests ok. 236 | 237 | 238 | Overall summary one sided P-value (smaller numbers bad) 239 | P = 0.977 : ok -------------------------------------------------------------------------------- /src/ent.c: -------------------------------------------------------------------------------- 1 | /* 2 | Apply various randomness tests to a stream of bytes. Adapted to 3 | work comfortably with ADAM but no test logic has been modified 4 | 5 | Designed and implemented by John "Random" Walker in May 1985. 6 | 7 | For additional information and the latest version, 8 | see https://www.fourmilab.ch/random/ 9 | 10 | Chi Square computation code was developed by Gary Perlman of the Wang 11 | Institute (full citations below) and has been minimally 12 | modified for use in this program. 13 | */ 14 | #include 15 | 16 | #include "../include/ent.h" 17 | 18 | #define LOG2(x) (log2of10 * log10(x)) 19 | #define ex(x) (((x) < -BIGX) ? 0.0 : exp(x)) 20 | 21 | static u64 ccount[256] ALIGN(64), // Bins to count occurrences of values 22 | totalc; // Total bytes counted 23 | 24 | static double prob[256]; // Probabilities per bin for entropy 25 | 26 | static u8 mp; 27 | static u64 monte[MONTEN]; 28 | static u64 inmont, mcount; 29 | static double incirc = 2.8147494E14; 30 | static double cexp, montex, montey, montepi, scc, sccun, scclast, 31 | scct1, scct2, scct3, ent, chisq, datasum; 32 | 33 | /* 34 | Module: z.c 35 | Purpose: compute approximations to normal z distribution probabilities 36 | Programmer: Gary Perlman 37 | Organization: Wang Institute, Tyngsboro, MA 01879 38 | Copyright: none 39 | Tabstops: 4 40 | 41 | poz: probability of normal z value 42 | 43 | PARAM z: normal z value 44 | 45 | Adapted from a polynomial approximation in: 46 | Ibbetson D, Algorithm 209 47 | Collected Algorithms of the CACM 1963 p. 616 48 | Note: 49 | This routine has six digit accuracy, so it is only useful for absolute 50 | z values < 6. For z values >= to 6.0, poz() returns 0.0. 51 | */ 52 | static double ent_poz(const double z) 53 | { 54 | register double y, x, w; 55 | 56 | if (z == 0.0) { 57 | x = 0.0; 58 | } else { 59 | y = 0.5 * fabs(z); 60 | if (y >= (Z_MAX * 0.5)) { 61 | x = 1.0; 62 | } else if (y < 1.0) { 63 | w = y * y; 64 | x = ((((((((0.000124818987 * w - 0.001075204047) * w + 0.005198775019) * w - 0.019198292004) * w + 0.059054035642) * w - 0.151968751364) * w + 0.319152932694) * w - 0.531923007300) * w + 0.797884560593) * y * 2.0; 65 | } else { 66 | y -= 2.0; 67 | x = (((((((((((((-0.000045255659 * y + 0.000152529290) * y - 0.000019538132) * y - 0.000676904986) * y + 0.001390604284) * y - 0.000794620820) * y - 0.002034254874) * y + 0.006549791214) * y - 0.010557625006) * y + 0.011630447319) * y - 0.009279453341) * y + 0.005353579108) * y - 0.002141268741) * y + 0.000535310849) * y + 0.999936657524; 68 | } 69 | } 70 | 71 | return (z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5)); 72 | } 73 | 74 | /* 75 | Module: chisq.c 76 | Purpose: compute approximations to chisquare distribution probabilities 77 | Contents: pochisq() 78 | Uses: poz() in z.c (Algorithm 209) 79 | Programmer: Gary Perlman 80 | Organization: Wang Institute, Tyngsboro, MA 01879 81 | Copyright: none 82 | Tabstops: 4 83 | 84 | pochisq: probability of chi sqaure value 85 | 86 | PARAM ax: the obtained chi-square value from previous calculations 87 | 88 | Adapted from: 89 | Hill, I. D. and Pike, M. C. Algorithm 299 90 | Collected Algorithms for the CACM 1967 p. 243 91 | Updated for rounding errors based on remark in 92 | ACM TOMS June 1985, page 185 93 | */ 94 | static double ent_pochisq(const double ax) 95 | { 96 | register double a, e, c, s, x, y, z; 97 | 98 | if (ax <= 0.0) 99 | return 1.0; 100 | 101 | a = 0.5 * ax; 102 | y = ex(-a); 103 | 104 | s = 2.0 * ent_poz(-sqrt(ax)); 105 | x = 0.5 * 255; 106 | z = 0.5; 107 | 108 | if (a > BIGX) { 109 | e = LOG_SQRT_PI; 110 | c = log(a); 111 | while (z <= x) { 112 | e = log(z) + e; 113 | s += ex(c * z - a - e); 114 | z += 1.0; 115 | } 116 | return s; 117 | } 118 | 119 | e = (I_SQRT_PI / sqrt(a)); 120 | c = 0.0; 121 | while (z <= x) { 122 | e = e * (a / z); 123 | c = c + e; 124 | z += 1.0; 125 | } 126 | return (c * y + s); 127 | } 128 | 129 | // Need to do a little rewrite to make ent process 8 bytes at a time 130 | // since ADAM's default work unit is 64 bits 131 | void ent_loop(const u8 *byte) 132 | { 133 | // Update counters for each bin, and then total 134 | ++ccount[byte[0]]; 135 | ++ccount[byte[1]]; 136 | ++ccount[byte[2]]; 137 | ++ccount[byte[3]]; 138 | ++ccount[byte[4]]; 139 | ++ccount[byte[5]]; 140 | ++ccount[byte[6]]; 141 | ++ccount[byte[7]]; 142 | totalc += 8; 143 | 144 | register u8 i = 0; 145 | do { 146 | /* 147 | Update inside / outside circle counts 148 | for Monte Carlo computation of PI 149 | */ 150 | 151 | // Save 6 bytes for Monte Carlo 152 | monte[mp++] = byte[i]; 153 | if (mp >= MONTEN) { 154 | // Calculate every MONTEN character 155 | mp = 0; 156 | ++mcount; 157 | montex = montey = 0.0; 158 | for (u8 mj = 0; mj < (MONTEN >> 1); ++mj) { 159 | montex = (montex * 256.0) + monte[mj]; 160 | montey = (montey * 256.0) + monte[(MONTEN >> 1) + mj]; 161 | } 162 | inmont += ((montex * montex + montey * montey) <= incirc); 163 | } 164 | 165 | sccun = byte[i]; 166 | scct1 += scclast * sccun; 167 | scct2 += sccun; 168 | scct3 += (sccun * sccun); 169 | scclast = sccun; 170 | } while (++i < 8); 171 | } 172 | 173 | void ent_results(ent_test *rsl) 174 | { 175 | register u16 i; 176 | 177 | // Complete calculation of serial correlation coefficient 178 | scct1 = scct1 + scclast * rsl->sccu0; 179 | scct2 *= scct2; 180 | scc = totalc * scct3 - scct2; 181 | scc = (scc == 0.0) ? -100000 : ((totalc * scct1 - scct2) / scc); 182 | 183 | /* 184 | Scan bins and calculate probability for each bin and 185 | Chi-Square distribution. The probability will be reused 186 | in the entropy calculation below. While we're at it, we 187 | sum of all the data which will be used to compute the mean. 188 | */ 189 | register double a; 190 | cexp = totalc / 256.0; // Expected count per bin 191 | for (i = 0; i < 256; ++i) { 192 | a = ccount[i] - cexp; 193 | prob[i] = ((double) ccount[i]) / totalc; 194 | chisq += (a * a) / cexp; 195 | datasum += ((double) i) * ccount[i]; 196 | } 197 | 198 | for (i = 0; i < 256; ++i) { 199 | if (prob[i] > 0.0) { 200 | ent += prob[i] * LOG2(1.0 / prob[i]); // change to (prob[i] > 0.0) * prob[i] * LOG2(1 / prob[i]); 201 | } 202 | } 203 | 204 | /* 205 | Calculate Monte Carlo value for PI from percentage of hits 206 | within the circle 207 | */ 208 | montepi = 4.0 * (((double) inmont) / mcount); 209 | 210 | rsl->ent = ent; 211 | rsl->chisq = chisq; 212 | rsl->pochisq = ent_pochisq(chisq); 213 | rsl->mean = datasum / totalc; 214 | rsl->montepicalc = montepi; 215 | rsl->monterr = 100.0 * (fabs(PI - montepi) / PI); 216 | rsl->scc = scc; 217 | rsl->freq = &ccount[0]; 218 | } 219 | -------------------------------------------------------------------------------- /tests/gjrand-100MB.txt: -------------------------------------------------------------------------------- 1 | ***** MCP version 13 --small ***** 2 | 3 | ============ 4 | binr -c 1/280 (374491 bytes) 5 | ======= 6 | dim = 128 ; rnk = 128 ; p = 1 7 | dim = 256 ; rnk = 252 ; p = 0.125 8 | done 5 matrices ; largest 896 X 896 9 | 10 | processed in 0 seconds. Thu Nov 9 10:36:17 2023 11 | 12 | one sided P value (very small numbers are bad) 13 | P = 0.487 14 | ... after 1 tests running guess [p] = 0.49 15 | 16 | 17 | ============ 18 | rda 1/1 (104857600 bytes) 19 | ======= 20 | chisquare (df=749) 768 (p = 0.307) 21 | extreme = 0.000876 (93 -) (p = 0.482) 22 | zero1st = 0.0172 (114 +) (p = 1) 23 | ext = 262066 ; exk = 94692 ; expect = 93961 24 | 25 | processed 1e+08 bytes in 1 seconds. Thu Nov 9 10:36:18 2023 26 | 27 | one sided P value (very small numbers are bad) 28 | P = 0.667 29 | ... after 2 tests running guess [p] = 0.74 30 | 31 | 32 | ============ 33 | z9 1/1 (104857600 bytes) 34 | ======= 35 | mix3 extreme = 2.37074 (lags = 10000001) low weight 44 36 | mix3 extreme = 3.30253 (lags = 2100001) medium weight 378 37 | mix3 extreme = 3.93407 (lags = 22100101) high weight 6138 38 | bits per word = 32 : sub-test P value = 0.663 39 | 40 | mix3 extreme = 1.77404 (lags = 00011) low weight 44 41 | mix3 extreme = 2.97804 (lags = 112) medium weight 378 42 | mix3 extreme = 3.94207 (lags = 00022112) high weight 6138 43 | bits per word = 128 : sub-test P value = 0.774 44 | 45 | mix3 extreme = 2.50155 (lags = 01) low weight 44 46 | mix3 extreme = 3.07937 (lags = 1001011) medium weight 378 47 | mix3 extreme = 4.24811 (lags = 00212122) high weight 6138 48 | bits per word = 512 : sub-test P value = 0.328 49 | 50 | processed 1e+08 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 51 | 52 | one sided P value (very small numbers are bad) 53 | P = 0.696 54 | ... after 3 tests running guess [p] = 0.86 55 | 56 | 57 | ============ 58 | diff12 1/7 (14979657 bytes) 59 | ======= 60 | order = 0 : chis = 2026 ; p = 0.75277 61 | order = 1 : chis = 2129 ; p = 0.203099 62 | order = 2 : chis = 2176 ; p = 0.0470099 63 | order = 3 : chis = 2103 ; p = 0.384219 64 | order = 4 : chis = 2026 ; p = 0.754573 65 | order = 5 : chis = 1972 ; p = 0.237371 66 | order = 6 : chis = 2065 ; p = 0.769443 67 | order = 7 : chis = 2054 ; p = 0.900757 68 | order = 8 : chis = 2050 ; p = 0.956033 69 | order = 9 : chis = 2199 ; p = 0.0194576 70 | order = 10 : chis = 2096 ; p = 0.438445 71 | order = 11 : chis = 2146 ; p = 0.124674 72 | 73 | processed 1.5e+07 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 74 | 75 | one sided P value (very small numbers are bad) 76 | P = 0.21 77 | ... after 4 tests running guess [p] = 0.61 78 | 79 | 80 | ============ 81 | lownda 1/2 (52428800 bytes) 82 | ======= 83 | extreme = 5.59e-05 (12 8 6 +) 84 | transform = 3.72 (e f 34) 85 | pvals (0.497 0.914) 86 | 87 | processed 5.2e+07 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 88 | 89 | one sided P value (very small numbers are bad) 90 | P = 0.747 91 | ... after 5 tests running guess [p] = 0.69 92 | 93 | 94 | ============ 95 | nda 1/28 (3744914 bytes) 96 | ======= 97 | extreme = 3.32e-05 (4 2 46 +) 98 | transform = 3.65 (a 4 9) 99 | pvals (0.335 0.96) 100 | 101 | processed 3.7e+06 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 102 | 103 | one sided P value (very small numbers are bad) 104 | P = 0.558 105 | ... after 6 tests running guess [p] = 0.76 106 | 107 | 108 | ============ 109 | v256 1/1 (104857600 bytes) 110 | ======= 111 | minimum = 138 (prob = 0.1730549232 0.4041220080) 112 | maximum = 185 (prob = 0.3234485149 0.6542294316) 113 | 114 | expected range [ 14.0 17.8 23.9 44.9 56.1 65.3 ] 115 | chi-squared = 36.54416 116 | 117 | processed 1e+08 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 118 | 119 | one sided P value (very small numbers are bad) 120 | P = 0.668 121 | ... after 7 tests running guess [p] = 0.81 122 | 123 | 124 | ============ 125 | mod3 1/1 (104857600 bytes) 126 | ======= 127 | chis = 19821.5 ; df = 19682 ; p = 0.24044 128 | mix3 extreme = 3.91069 ; p = 0.70112 129 | 130 | processed 1e+08 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 131 | 132 | one sided P value (very small numbers are bad) 133 | P = 0.423 134 | ... after 8 tests running guess [p] = 0.85 135 | 136 | 137 | ============ 138 | selfcor 1/1 (104857600 bytes) 139 | ======= 140 | forward (msb) : mean=-0.002992 ; sd=0.999883 ; ext = 4.424372 (23230) 141 | ==> p = 0.272 142 | reverse (lsb) : mean=-0.003592 ; sd=1.004566 ; ext = 4.177829 (30017) 143 | ==> p = 0.619 144 | 145 | processed 1e+08 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 146 | 147 | one sided P value (very small numbers are bad) 148 | P = 0.469 149 | ... after 9 tests running guess [p] = 0.88 150 | 151 | 152 | ============ 153 | rda16 1/12 (8738133 bytes) 154 | ======= 155 | simple 156 | chis = 69592 (p = 0.862) 157 | extreme = 8.65e-06 (59852 +) (p = 0.454) 158 | zero1st = 8.07e-05 (3567 +) (p = 0.996) 159 | ext = 62 ; exk = 13 ; expect = 3.28 160 | 161 | zero1st 162 | zero1st = 0.000331 (13594 +) (p = 1) 163 | ext = 58 ; exk = 25 ; expect = 10.9 164 | 165 | 166 | processed 8.5e+06 bytes in 0 seconds. Thu Nov 9 10:36:18 2023 167 | 168 | one sided P value (very small numbers are bad) 169 | P = 0.911 170 | ... after 10 tests running guess [p] = 0.91 171 | 172 | 173 | ============ 174 | z9 -t 1/1 (104857600 bytes) 175 | ======= 176 | transitions 177 | mix3 extreme = 2.29453 (lags = 001001) low weight 44 178 | mix3 extreme = 3.34501 (lags = 200101) medium weight 378 179 | mix3 extreme = 3.62679 (lags = 10021111) high weight 6138 180 | bits per word = 32 : sub-test P value = 0.607 181 | 182 | mix3 extreme = 2.51093 (lags = 000101) low weight 44 183 | mix3 extreme = 2.80405 (lags = 01201) medium weight 378 184 | mix3 extreme = 3.92280 (lags = 01012101) high weight 6138 185 | bits per word = 128 : sub-test P value = 0.798 186 | 187 | mix3 extreme = 3.09911 (lags = 0100001) low weight 44 188 | mix3 extreme = 3.74562 (lags = 1011001) medium weight 378 189 | mix3 extreme = 3.67836 (lags = 0001121) high weight 6138 190 | bits per word = 512 : sub-test P value = 0.185 191 | 192 | processed 1e+08 bytes in 1 seconds. Thu Nov 9 10:36:19 2023 193 | 194 | one sided P value (very small numbers are bad) 195 | P = 0.458 196 | ... after 11 tests running guess [p] = 0.93 197 | 198 | 199 | ============ 200 | sh5da 1/1 (104857600 bytes) 201 | ======= 202 | native byte order : (df=364) chis=336.30 p = 0.848 203 | extreme = 0.00381 (32 +) (p = 0.751) 204 | reverse byte order: (df=364) chis=359.94 p = 0.55 205 | extreme = 0.0022 (265 +) (p = 0.552) 206 | 207 | processed 1e+08 bytes in 0 seconds. Thu Nov 9 10:36:19 2023 208 | 209 | one sided P value (very small numbers are bad) 210 | P = 0.959 211 | ... after 12 tests running guess [p] = 0.94 212 | 213 | 214 | ============ 215 | slicerda 1/3 (34952533 bytes) 216 | ======= 217 | expected range [ 633 662 699 799 841 875 ] 218 | 0 : 744.94008 219 | 2 : 691.75332 220 | 4 : 752.17866 221 | 6 : 793.31939 222 | 8 : 737.84262 223 | 10 : 817.55234 224 | 12 : 802.09627 225 | 14 : 746.48359 226 | 16 : 744.89545 227 | 18 : 817.65084 228 | 20 : 782.86295 229 | 22 : 813.21893 230 | 24 : 729.25137 231 | 26 : 696.85927 232 | 28 : 723.03825 233 | 30 : 736.07435 234 | extreme = 2.99e-05 (12 428 -) 235 | pvals (0.488 0.301) 236 | 237 | processed 3.5e+07 bytes in 0 seconds. Thu Nov 9 10:36:19 2023 238 | 239 | one sided P value (very small numbers are bad) 240 | P = 0.512 241 | 242 | 243 | ==================== 244 | completed 13 tests 245 | 13 out of 13 tests ok. 246 | 247 | 248 | Overall summary one sided P-value (smaller numbers bad) 249 | P = 0.953 : ok -------------------------------------------------------------------------------- /tests/gjrand-1GB.txt: -------------------------------------------------------------------------------- 1 | ***** MCP version 13 --standard ***** 2 | 3 | ============ 4 | binr -c 1/280 (3834792 bytes) 5 | ======= 6 | dim = 128 ; rnk = 126 ; p = 0.5 7 | dim = 896 ; rnk = 893 ; p = 0.25 8 | done 8 matrices ; largest 3328 X 3328 9 | 10 | processed in 0 seconds. Mon Nov 6 18:26:10 2023 11 | 12 | one sided P value (very small numbers are bad) 13 | P = 0.9 14 | ... after 1 tests running guess [p] = 0.9 15 | 16 | 17 | ============ 18 | rda 1/1 (1073741824 bytes) 19 | ======= 20 | chisquare (df=749) 732 (p = 0.665) 21 | extreme = 0.00045 (582 -) (p = 0.286) 22 | zero1st = 0.0134 (229 +) (p = 1) 23 | ext = 1710906 ; exk = 1014918 ; expect = 1012429 24 | 25 | processed 1.1e+09 bytes in 5 seconds. Mon Nov 6 18:26:15 2023 26 | 27 | one sided P value (very small numbers are bad) 28 | P = 0.637 29 | ... after 2 tests running guess [p] = 0.87 30 | 31 | 32 | ============ 33 | z9 1/1 (1073741824 bytes) 34 | ======= 35 | mix3 extreme = 1.98631 (lags = 00000002) low weight 44 36 | mix3 extreme = 3.23734 (lags = 00111001) medium weight 378 37 | mix3 extreme = 3.69166 (lags = 21022202) high weight 6138 38 | bits per word = 32 : sub-test P value = 0.746 39 | 40 | mix3 extreme = 1.67282 (lags = 010001) low weight 44 41 | mix3 extreme = 3.19584 (lags = 211) medium weight 378 42 | mix3 extreme = 4.17819 (lags = 12000221) high weight 6138 43 | bits per word = 128 : sub-test P value = 0.418 44 | 45 | mix3 extreme = 2.60777 (lags = 00101) low weight 44 46 | mix3 extreme = 3.04592 (lags = 00010102) medium weight 378 47 | mix3 extreme = 3.66603 (lags = 10221102) high weight 6138 48 | bits per word = 512 : sub-test P value = 0.701 49 | 50 | processed 1.1e+09 bytes in 1 seconds. Mon Nov 6 18:26:16 2023 51 | 52 | one sided P value (very small numbers are bad) 53 | P = 0.803 54 | ... after 3 tests running guess [p] = 0.95 55 | 56 | 57 | ============ 58 | diff12 1/7 (153391689 bytes) 59 | ======= 60 | order = 0 : chis = 1905 ; p = 0.0238187 61 | order = 1 : chis = 1986 ; p = 0.342985 62 | order = 2 : chis = 1975 ; p = 0.260468 63 | order = 3 : chis = 2122 ; p = 0.24213 64 | order = 4 : chis = 1965 ; p = 0.196477 65 | order = 5 : chis = 2044 ; p = 0.968046 66 | order = 6 : chis = 2070 ; p = 0.713184 67 | order = 7 : chis = 2134 ; p = 0.177455 68 | order = 8 : chis = 2066 ; p = 0.753505 69 | order = 9 : chis = 2077 ; p = 0.630239 70 | order = 10 : chis = 1928 ; p = 0.0581565 71 | order = 11 : chis = 2086 ; p = 0.53532 72 | 73 | processed 1.5e+08 bytes in 1 seconds. Mon Nov 6 18:26:17 2023 74 | 75 | one sided P value (very small numbers are bad) 76 | P = 0.251 77 | ... after 4 tests running guess [p] = 0.69 78 | 79 | 80 | ============ 81 | lownda 1/2 (536870912 bytes) 82 | ======= 83 | extreme = 4.51e-05 (15 14 47 -) 84 | transform = 4.24 (8 6 41) 85 | pvals (0.425 0.241) 86 | 87 | processed 5.4e+08 bytes in 1 seconds. Mon Nov 6 18:26:18 2023 88 | 89 | one sided P value (very small numbers are bad) 90 | P = 0.424 91 | ... after 5 tests running guess [p] = 0.76 92 | 93 | 94 | ============ 95 | nda 1/28 (38347922 bytes) 96 | ======= 97 | extreme = 0.000244 (6 1 10 +) 98 | transform = 3.97 (f 9 36) 99 | pvals (0.95 0.586) 100 | 101 | processed 3.8e+07 bytes in 1 seconds. Mon Nov 6 18:26:19 2023 102 | 103 | one sided P value (very small numbers are bad) 104 | P = 0.829 105 | ... after 6 tests running guess [p] = 0.82 106 | 107 | 108 | ============ 109 | v256 1/1 (1073741824 bytes) 110 | ======= 111 | minimum = 136 (prob = 0.2077334036 0.4967013241) 112 | maximum = 186 (prob = 0.7560141229 0.9817071774) 113 | 114 | expected range [ 14.0 17.8 23.9 44.9 56.1 65.3 ] 115 | chi-squared = 30.77043 116 | 117 | processed 1.1e+09 bytes in 1 seconds. Mon Nov 6 18:26:20 2023 118 | 119 | one sided P value (very small numbers are bad) 120 | P = 0.866 121 | ... after 7 tests running guess [p] = 0.87 122 | 123 | 124 | ============ 125 | mod3 1/1 (1073741824 bytes) 126 | ======= 127 | chis = 19900.2 ; df = 19682 ; p = 0.13589 128 | mix3 extreme = 4.13559 ; p = 0.37161 129 | 130 | processed 1.1e+09 bytes in 1 seconds. Mon Nov 6 18:26:21 2023 131 | 132 | one sided P value (very small numbers are bad) 133 | P = 0.253 134 | ... after 8 tests running guess [p] = 0.9 135 | 136 | 137 | ============ 138 | selfcor 1/1 (1073741824 bytes) 139 | ======= 140 | forward (msb) : mean=-0.003910 ; sd=1.001255 ; ext = -4.266475 (9833) 141 | ==> p = 0.478 142 | reverse (lsb) : mean=-0.003765 ; sd=0.983442 ; ext = -4.193057 (27464) 143 | ==> p = 0.594 144 | 145 | processed 1.1e+09 bytes in 1 seconds. Mon Nov 6 18:26:22 2023 146 | 147 | one sided P value (very small numbers are bad) 148 | P = 0.728 149 | ... after 9 tests running guess [p] = 0.93 150 | 151 | 152 | ============ 153 | rda16 1/12 (89478485 bytes) 154 | ======= 155 | simple 156 | chis = 70015 (p = 0.482) 157 | extreme = 6.51e-06 (28871 -) (p = 0.366) 158 | zero1st = 8.89e-05 (3720 -) (p = 0.998) 159 | ext = 637 ; exk = 14 ; expect = 35.1 160 | 161 | zero1st 162 | zero1st = 5.25e-05 (4987 -) (p = 0.975) 163 | ext = 612 ; exk = 20 ; expect = 44.8 164 | 165 | 166 | processed 8.9e+07 bytes in 1 seconds. Mon Nov 6 18:26:23 2023 167 | 168 | one sided P value (very small numbers are bad) 169 | P = 0.838 170 | ... after 10 tests running guess [p] = 0.94 171 | 172 | 173 | ============ 174 | z9 -t 1/1 (1073741824 bytes) 175 | ======= 176 | transitions 177 | mix3 extreme = 2.83580 (lags = 011) low weight 44 178 | mix3 extreme = 2.88408 (lags = 11010001) medium weight 378 179 | mix3 extreme = 3.87413 (lags = 2112112) high weight 6138 180 | bits per word = 32 : sub-test P value = 0.454 181 | 182 | mix3 extreme = 1.80647 (lags = 000011) low weight 44 183 | mix3 extreme = 2.88672 (lags = 0012001) medium weight 378 184 | mix3 extreme = 3.81037 (lags = 02201001) high weight 6138 185 | bits per word = 128 : sub-test P value = 0.922 186 | 187 | mix3 extreme = 2.62542 (lags = 00011) low weight 44 188 | mix3 extreme = 3.04415 (lags = 0101011) medium weight 378 189 | mix3 extreme = 3.90737 (lags = 20220011) high weight 6138 190 | bits per word = 512 : sub-test P value = 0.683 191 | 192 | processed 1.1e+09 bytes in 2 seconds. Mon Nov 6 18:26:25 2023 193 | 194 | one sided P value (very small numbers are bad) 195 | P = 0.837 196 | ... after 11 tests running guess [p] = 0.96 197 | 198 | 199 | ============ 200 | sh5da 1/1 (1073741824 bytes) 201 | ======= 202 | native byte order : (df=364) chis=351.91 p = 0.666 203 | extreme = 0.00604 (96 -) (p = 0.891) 204 | reverse byte order: (df=364) chis=358.20 p = 0.576 205 | extreme = 0.00153 (154 -) (p = 0.427) 206 | 207 | processed 1.1e+09 bytes in 1 seconds. Mon Nov 6 18:26:26 2023 208 | 209 | one sided P value (very small numbers are bad) 210 | P = 0.893 211 | ... after 12 tests running guess [p] = 0.97 212 | 213 | 214 | ============ 215 | slicerda 1/3 (357913941 bytes) 216 | ======= 217 | expected range [ 633 662 699 799 841 875 ] 218 | 0 : 707.78883 219 | 2 : 751.16945 220 | 4 : 783.58924 221 | 6 : 733.35083 222 | 8 : 772.77810 223 | 10 : 771.97678 224 | 12 : 767.99601 225 | 14 : 805.88034 226 | 16 : 728.84861 227 | 18 : 678.68982 228 | 20 : 776.29495 229 | 22 : 696.83731 230 | 24 : 777.34804 231 | 26 : 757.56658 232 | 28 : 753.97762 233 | 30 : 766.06681 234 | extreme = 2.66e-05 (2 429 -) 235 | pvals (0.705 0.273) 236 | 237 | processed 3.6e+08 bytes in 0 seconds. Mon Nov 6 18:26:26 2023 238 | 239 | one sided P value (very small numbers are bad) 240 | P = 0.471 241 | 242 | 243 | ==================== 244 | completed 13 tests 245 | 13 out of 13 tests ok. 246 | 247 | 248 | Overall summary one sided P-value (smaller numbers bad) 249 | P = 0.977 : ok -------------------------------------------------------------------------------- /tests/gjrand-10GB.txt: -------------------------------------------------------------------------------- 1 | 2 | ***** MCP version 13 --big ***** 3 | 4 | 5 | 6 | ============ 7 | binr -c 1/280 (38347922 bytes) 8 | ======= 9 | dim = 128 ; rnk = 127 ; p = 1 10 | dim = 640 ; rnk = 637 ; p = 0.25 11 | done 11 matrices ; largest 10752 X 10752 12 | 13 | processed in 2 seconds. Wed Feb 14 15:16:37 2024 14 | 15 | one sided P value (very small numbers are bad) 16 | P = 0.958 17 | ... after 1 tests running guess [p] = 0.96 18 | 19 | 20 | ============ 21 | rda 1/1 (10737418240 bytes) 22 | ======= 23 | chisquare (df=749) 736 (p = 0.622) 24 | extreme = 0.00272 (284 -) (p = 0.871) 25 | zero1st = 0.0271 (38 +) (p = 1) 26 | ext = 36145607 ; exk = 4895721 ; expect = 4890833 27 | 28 | processed 1.1e+10 bytes in 42 seconds. Wed Feb 14 15:17:19 2024 29 | 30 | one sided P value (very small numbers are bad) 31 | P = 0.946 32 | ... after 2 tests running guess [p] = 1 33 | 34 | 35 | ============ 36 | z9 1/1 (10737418240 bytes) 37 | ======= 38 | mix3 extreme = 2.89207 (lags = 100001) low weight 44 39 | mix3 extreme = 3.12757 (lags = 21001) medium weight 378 40 | mix3 extreme = 3.74644 (lags = 12211201) high weight 6138 41 | bits per word = 32 : sub-test P value = 0.397 42 | 43 | mix3 extreme = 2.98307 (lags = 00000001) low weight 44 44 | mix3 extreme = 3.66004 (lags = 21000001) medium weight 378 45 | mix3 extreme = 3.89336 (lags = 22112121) high weight 6138 46 | bits per word = 128 : sub-test P value = 0.249 47 | 48 | mix3 extreme = 2.02194 (lags = 001) low weight 44 49 | mix3 extreme = 2.99456 (lags = 00002101) medium weight 378 50 | mix3 extreme = 3.78804 (lags = 01021221) high weight 6138 51 | bits per word = 512 : sub-test P value = 0.939 52 | 53 | processed 1.1e+10 bytes in 18 seconds. Wed Feb 14 15:17:37 2024 54 | 55 | one sided P value (very small numbers are bad) 56 | P = 0.576 57 | ... after 3 tests running guess [p] = 0.92 58 | 59 | 60 | ============ 61 | diff12 1/7 (1533916891 bytes) 62 | ======= 63 | order = 0 : chis = 1977 ; p = 0.274154 64 | order = 1 : chis = 2038 ; p = 0.89534 65 | order = 2 : chis = 2035 ; p = 0.854938 66 | order = 3 : chis = 2033 ; p = 0.830632 67 | order = 4 : chis = 2113 ; p = 0.300324 68 | order = 5 : chis = 1963 ; p = 0.185297 69 | order = 6 : chis = 2025 ; p = 0.738131 70 | order = 7 : chis = 2099 ; p = 0.411406 71 | order = 8 : chis = 2005 ; p = 0.51322 72 | order = 9 : chis = 2138 ; p = 0.158352 73 | order = 10 : chis = 2121 ; p = 0.246029 74 | order = 11 : chis = 2006 ; p = 0.524878 75 | 76 | processed 1.5e+09 bytes in 11 seconds. Wed Feb 14 15:17:48 2024 77 | 78 | one sided P value (very small numbers are bad) 79 | P = 0.874 80 | ... after 4 tests running guess [p] = 0.97 81 | 82 | 83 | ============ 84 | lownda 1/2 (5368709120 bytes) 85 | ======= 86 | extreme = 1.13e-05 (1 1 45 -) 87 | transform = 4.02 (f d 1) 88 | pvals (0.13 0.518) 89 | 90 | processed 5.4e+09 bytes in 4 seconds. Wed Feb 14 15:17:52 2024 91 | 92 | one sided P value (very small numbers are bad) 93 | P = 0.243 94 | ... after 5 tests running guess [p] = 0.75 95 | 96 | 97 | ============ 98 | nda 1/28 (383479222 bytes) 99 | ======= 100 | extreme = 8.1e-05 (13 13 27 -) 101 | transform = 4.55 (2 6 40) 102 | pvals (0.631 0.0647) 103 | 104 | processed 3.8e+08 bytes in 6 seconds. Wed Feb 14 15:17:58 2024 105 | 106 | one sided P value (very small numbers are bad) 107 | P = 0.125 108 | ... after 6 tests running guess [p] = 0.55 109 | 110 | 111 | ============ 112 | v256 1/1 (10737418240 bytes) 113 | ======= 114 | minimum = 133 (prob = 0.0690062643 0.2115452614) 115 | maximum = 189 (prob = 0.3790277652 0.7856112706) 116 | 117 | expected range [ 14.0 17.8 23.9 44.9 56.1 65.3 ] 118 | chi-squared = 30.41824 119 | 120 | processed 1.1e+10 bytes in 9 seconds. Wed Feb 14 15:18:07 2024 121 | 122 | one sided P value (very small numbers are bad) 123 | P = 0.808 124 | ... after 7 tests running guess [p] = 0.61 125 | 126 | 127 | ============ 128 | mod3 1/1 (10737418240 bytes) 129 | ======= 130 | chis = 19745.2 ; df = 19682 ; p = 0.37392 131 | mix3 extreme = 4.08547 ; p = 0.43855 132 | 133 | processed 1.1e+10 bytes in 10 seconds. Wed Feb 14 15:18:17 2024 134 | 135 | one sided P value (very small numbers are bad) 136 | P = 0.608 137 | ... after 8 tests running guess [p] = 0.66 138 | 139 | 140 | ============ 141 | selfcor 1/1 (10737418240 bytes) 142 | ======= 143 | forward (msb) : mean=-0.003805 ; sd=1.002460 ; ext = 4.442147 (10425) 144 | ==> p = 0.253 145 | reverse (lsb) : mean=0.004152 ; sd=0.999501 ; ext = 4.014724 (6122) 146 | ==> p = 0.858 147 | 148 | processed 1.1e+10 bytes in 11 seconds. Wed Feb 14 15:18:28 2024 149 | 150 | one sided P value (very small numbers are bad) 151 | P = 0.442 152 | ... after 9 tests running guess [p] = 0.7 153 | 154 | 155 | ============ 156 | rda16 1/12 (894784853 bytes) 157 | ======= 158 | simple 159 | chis = 69262 (p = 0.976) 160 | extreme = 3.73e-05 (64882 +) (p = 0.927) 161 | zero1st = 9.65e-05 (6907 -) (p = 0.999) 162 | ext = 6163 ; exk = 522 ; expect = 616 163 | 164 | zero1st 165 | zero1st = 5.64e-05 (12190 -) (p = 0.981) 166 | ext = 5664 ; exk = 839 ; expect = 961 167 | 168 | 169 | processed 8.9e+08 bytes in 2 seconds. Wed Feb 14 15:18:30 2024 170 | 171 | one sided P value (very small numbers are bad) 172 | P = 1 173 | ... after 10 tests running guess [p] = 0.74 174 | 175 | 176 | ============ 177 | z9 -t 1/1 (10737418240 bytes) 178 | ======= 179 | transitions 180 | mix3 extreme = 2.86046 (lags = 000001) low weight 44 181 | mix3 extreme = 3.55974 (lags = 0100111) medium weight 378 182 | mix3 extreme = 3.84252 (lags = 10102212) high weight 6138 183 | bits per word = 32 : sub-test P value = 0.344 184 | 185 | mix3 extreme = 2.94252 (lags = 00001001) low weight 44 186 | mix3 extreme = 3.55487 (lags = 100201) medium weight 378 187 | mix3 extreme = 4.39981 (lags = 22022112) high weight 6138 188 | bits per word = 128 : sub-test P value = 0.181 189 | 190 | mix3 extreme = 2.60143 (lags = 001001) low weight 44 191 | mix3 extreme = 3.31396 (lags = 10000201) medium weight 378 192 | mix3 extreme = 3.42476 (lags = 10211001) high weight 6138 193 | bits per word = 512 : sub-test P value = 0.648 194 | 195 | processed 1.1e+10 bytes in 19 seconds. Wed Feb 14 15:18:49 2024 196 | 197 | one sided P value (very small numbers are bad) 198 | P = 0.45 199 | ... after 11 tests running guess [p] = 0.77 200 | 201 | 202 | ============ 203 | sh5da 1/1 (10737418240 bytes) 204 | ======= 205 | native byte order : (df=364) chis=371.33 p = 0.384 206 | extreme = 0.00382 (109 -) (p = 0.752) 207 | reverse byte order: (df=364) chis=388.00 p = 0.185 208 | extreme = 0.00037 (51 +) (p = 0.126) 209 | 210 | processed 1.1e+10 bytes in 8 seconds. Wed Feb 14 15:18:57 2024 211 | 212 | one sided P value (very small numbers are bad) 213 | P = 0.417 214 | ... after 12 tests running guess [p] = 0.8 215 | 216 | 217 | ============ 218 | slicerda 1/3 (3579139413 bytes) 219 | ======= 220 | expected range [ 633 662 699 799 841 875 ] 221 | 0 : 730.33087 222 | 2 : 740.30694 223 | 4 : 748.41210 224 | 6 : 784.70276 225 | 8 : 697.35468 226 | 10 : 726.38666 227 | 12 : 774.01140 228 | 14 : 783.67991 229 | 16 : 704.13567 230 | 18 : 675.12934 231 | 20 : 712.77105 232 | 22 : 703.19651 233 | 24 : 812.22526 234 | 26 : 719.34817 235 | 28 : 727.36103 236 | 30 : 783.25606 237 | extreme = 2.9e-05 (24 626 -) 238 | pvals (0.589 0.294) 239 | 240 | processed 3.6e+09 bytes in 5 seconds. Wed Feb 14 15:19:02 2024 241 | 242 | one sided P value (very small numbers are bad) 243 | P = 0.501 244 | 245 | 246 | ==================== 247 | completed 13 tests 248 | 13 out of 13 tests ok. 249 | 250 | 251 | Overall summary one sided P-value (smaller numbers bad) 252 | P = 0.824 : ok -------------------------------------------------------------------------------- /tests/gjrand-100GB.txt: -------------------------------------------------------------------------------- 1 | ***** MCP version 13 --huge ***** 2 | 3 | ============ 4 | binr -c 1/280 (383479222 bytes) 5 | ======= 6 | dim = 128 ; rnk = 126 ; p = 0.5 7 | dim = 3328 ; rnk = 3324 ; p = 0.125 8 | done 14 matrices ; largest 27264 X 27264 9 | 10 | processed in 66 seconds. Mon Nov 6 21:25:41 2023 11 | 12 | one sided P value (very small numbers are bad) 13 | P = 0.846 14 | ... after 1 tests running guess [p] = 0.85 15 | 16 | 17 | ============ 18 | rda 1/1 (107374182400 bytes) 19 | ======= 20 | chisquare (df=749) 732 (p = 0.666) 21 | extreme = 0.00229 (476 +) (p = 0.82) 22 | zero1st = 0.00383 (3 +) (p = 0.944) 23 | ext = 414566536 ; exk = 3250337 ; expect = 3245127 24 | 25 | processed 1.1e+11 bytes in 1.45e+04 seconds. Tue Nov 7 01:28:08 2023 26 | 27 | one sided P value (very small numbers are bad) 28 | P = 0.963 29 | ... after 2 tests running guess [p] = 0.98 30 | 31 | 32 | ============ 33 | z9 1/1 (107374182400 bytes) 34 | ======= 35 | mix3 extreme = 2.36526 (lags = 0100001) low weight 44 36 | mix3 extreme = 2.80488 (lags = 01201) medium weight 378 37 | mix3 extreme = 3.72279 (lags = 22201012) high weight 6138 38 | bits per word = 32 : sub-test P value = 0.909 39 | 40 | mix3 extreme = 2.61242 (lags = 0000011) low weight 44 41 | mix3 extreme = 2.82319 (lags = 0101101) medium weight 378 42 | mix3 extreme = 3.56680 (lags = 01222022) high weight 6138 43 | bits per word = 128 : sub-test P value = 0.696 44 | 45 | mix3 extreme = 1.91132 (lags = 100001) low weight 44 46 | mix3 extreme = 3.24503 (lags = 1010101) medium weight 378 47 | mix3 extreme = 3.66296 (lags = 22210211) high weight 6138 48 | bits per word = 512 : sub-test P value = 0.736 49 | 50 | processed 1.1e+11 bytes in 2.79e+04 seconds. Tue Nov 7 09:13:26 2023 51 | 52 | one sided P value (very small numbers are bad) 53 | P = 0.972 54 | ... after 3 tests running guess [p] = 1 55 | 56 | 57 | ============ 58 | diff12 1/7 (15339168914 bytes) 59 | ======= 60 | order = 0 : chis = 2019 ; p = 0.663991 61 | order = 1 : chis = 1994 ; p = 0.410133 62 | order = 2 : chis = 1971 ; p = 0.234657 63 | order = 3 : chis = 2055 ; p = 0.893031 64 | order = 4 : chis = 1998 ; p = 0.449661 65 | order = 5 : chis = 2019 ; p = 0.669955 66 | order = 6 : chis = 2115 ; p = 0.28756 67 | order = 7 : chis = 1995 ; p = 0.416977 68 | order = 8 : chis = 2147 ; p = 0.120558 69 | order = 9 : chis = 2096 ; p = 0.445521 70 | order = 10 : chis = 2040 ; p = 0.9237 71 | order = 11 : chis = 2076 ; p = 0.641601 72 | 73 | processed 1.5e+10 bytes in 3.03e+03 seconds. Tue Nov 7 10:03:52 2023 74 | 75 | one sided P value (very small numbers are bad) 76 | P = 0.786 77 | ... after 4 tests running guess [p] = 1 78 | 79 | 80 | ============ 81 | lownda 1/2 (53687091200 bytes) 82 | ======= 83 | extreme = 0.000269 (3 15 26 +) 84 | transform = 4.03 (e e 31) 85 | pvals (0.963 0.503) 86 | 87 | processed 5.4e+10 bytes in 43 seconds. Tue Nov 7 10:04:35 2023 88 | 89 | one sided P value (very small numbers are bad) 90 | P = 0.753 91 | ... after 5 tests running guess [p] = 1 92 | 93 | 94 | ============ 95 | nda 1/28 (3834792228 bytes) 96 | ======= 97 | extreme = 9.74e-05 (2 6 24 -) 98 | transform = 3.92 (e 4 37) 99 | pvals (0.698 0.668) 100 | 101 | processed 3.8e+09 bytes in 43 seconds. Tue Nov 7 10:05:18 2023 102 | 103 | one sided P value (very small numbers are bad) 104 | P = 0.89 105 | ... after 6 tests running guess [p] = 1 106 | 107 | 108 | ============ 109 | v256 1/1 (107374182400 bytes) 110 | ======= 111 | minimum = 133 (prob = 0.5108212445 0.9071530427) 112 | maximum = 191 (prob = 0.3291163874 0.7559264993) 113 | 114 | expected range [ 14.0 17.8 23.9 44.9 56.1 65.3 ] 115 | chi-squared = 39.72435 116 | 117 | processed 1.1e+11 bytes in 91 seconds. Tue Nov 7 10:06:49 2023 118 | 119 | one sided P value (very small numbers are bad) 120 | P = 0.479 121 | ... after 7 tests running guess [p] = 0.99 122 | 123 | 124 | ============ 125 | mod3 1/1 (107374182400 bytes) 126 | ======= 127 | chis = 19524.7 ; df = 19682 ; p = 0.78566 128 | mix3 extreme = 3.80868 ; p = 0.84014 129 | 130 | processed 1.1e+11 bytes in 75 seconds. Tue Nov 7 10:08:04 2023 131 | 132 | one sided P value (very small numbers are bad) 133 | P = 0.954 134 | ... after 8 tests running guess [p] = 0.99 135 | 136 | 137 | ============ 138 | selfcor 1/1 (107374182400 bytes) 139 | ======= 140 | forward (msb) : mean=-0.002491 ; sd=1.001204 ; ext = -4.232455 (19847) 141 | ==> p = 0.531 142 | reverse (lsb) : mean=0.012456 ; sd=1.006228 ; ext = 4.222922 (12317) 143 | ==> p = 0.546 144 | 145 | processed 1.1e+11 bytes in 89 seconds. Tue Nov 7 10:09:33 2023 146 | 147 | one sided P value (very small numbers are bad) 148 | P = 0.78 149 | ... after 9 tests running guess [p] = 1 150 | 151 | 152 | ============ 153 | rda16 1/12 (8947848533 bytes) 154 | ======= 155 | simple 156 | chis = 69853 (p = 0.651) 157 | extreme = 1.44e-05 (54055 +) (p = 0.634) 158 | zero1st = 9.41e-05 (3087 -) (p = 0.999) 159 | ext = 65412 ; exk = 2797 ; expect = 3.01e+03 160 | 161 | zero1st 162 | zero1st = 3.26e-05 (12705 +) (p = 0.898) 163 | ext = 56196 ; exk = 10319 ; expect = 9.9e+03 164 | 165 | 166 | processed 8.9e+09 bytes in 16 seconds. Tue Nov 7 10:09:49 2023 167 | 168 | one sided P value (very small numbers are bad) 169 | P = 0.982 170 | ... after 10 tests running guess [p] = 1 171 | 172 | 173 | ============ 174 | z9 -t 1/1 (107374182400 bytes) 175 | ======= 176 | transitions 177 | mix3 extreme = 2.16004 (lags = 0002) low weight 44 178 | mix3 extreme = 3.38921 (lags = 01000021) medium weight 378 179 | mix3 extreme = 4.50811 (lags = 20221011) high weight 6138 180 | bits per word = 32 : sub-test P value = 0.113 181 | 182 | mix3 extreme = 2.73892 (lags = 01001) low weight 44 183 | mix3 extreme = 3.26514 (lags = 0011001) medium weight 378 184 | mix3 extreme = 3.74749 (lags = 11112211) high weight 6138 185 | bits per word = 128 : sub-test P value = 0.558 186 | 187 | mix3 extreme = 1.96187 (lags = 00101) low weight 44 188 | mix3 extreme = 3.25458 (lags = 11001001) medium weight 378 189 | mix3 extreme = 3.75214 (lags = 02021221) high weight 6138 190 | bits per word = 512 : sub-test P value = 0.724 191 | 192 | processed 1.1e+11 bytes in 134 seconds. Tue Nov 7 10:12:03 2023 193 | 194 | one sided P value (very small numbers are bad) 195 | P = 0.303 196 | ... after 11 tests running guess [p] = 0.98 197 | 198 | 199 | ============ 200 | sh5da 1/1 (107374182400 bytes) 201 | ======= 202 | native byte order : (df=364) chis=398.19 p = 0.105 203 | extreme = 0.000322 (74 -) (p = 0.111) 204 | reverse byte order: (df=364) chis=378.55 p = 0.289 205 | extreme = 0.00154 (281 +) (p = 0.429) 206 | 207 | processed 1.1e+11 bytes in 90 seconds. Tue Nov 7 10:13:33 2023 208 | 209 | one sided P value (very small numbers are bad) 210 | P = 0.358 211 | ... after 12 tests running guess [p] = 0.99 212 | 213 | 214 | ============ 215 | slicerda 1/3 (35791394133 bytes) 216 | ======= 217 | expected range [ 633 662 699 799 841 875 ] 218 | 0 : 795.76705 219 | 2 : 790.30678 220 | 4 : 775.81685 221 | 6 : 719.71142 222 | 8 : 752.28642 223 | 10 : 799.26763 224 | 12 : 746.89742 225 | 14 : 701.61571 226 | 16 : 751.28308 227 | 18 : 686.97310 228 | 20 : 743.76676 229 | 22 : 732.44842 230 | 24 : 723.95197 231 | 26 : 752.72157 232 | 28 : 702.07737 233 | 30 : 771.86895 234 | extreme = 0.000634 (2 262 -) 235 | pvals (0.811 0.999) 236 | 237 | processed 3.6e+10 bytes in 40 seconds. Tue Nov 7 10:14:13 2023 238 | 239 | one sided P value (very small numbers are bad) 240 | P = 0.964 241 | 242 | 243 | ==================== 244 | completed 13 tests 245 | 13 out of 13 tests ok. 246 | 247 | 248 | Overall summary one sided P-value (smaller numbers bad) 249 | P = 0.991 : ok -------------------------------------------------------------------------------- /tests/Dieharder.txt: -------------------------------------------------------------------------------- 1 | #=============================================================================# 2 | # dieharder version 3.31.1 Copyright 2003 Robert G. Brown # 3 | #=============================================================================# 4 | rng_name |rands/second| Seed | 5 | stdin_input_raw| 5.22e+07 | 453841699| 6 | #=============================================================================# 7 | test_name |ntup| tsamples |psamples| p-value |Assessment 8 | #=============================================================================# 9 | diehard_birthdays| 0| 100| 100|0.22060447| PASSED 10 | diehard_operm5| 0| 1000000| 100|0.99450882| PASSED 11 | diehard_rank_32x32| 0| 40000| 100|0.15041818| PASSED 12 | diehard_rank_6x8| 0| 100000| 100|0.81618537| PASSED 13 | diehard_bitstream| 0| 2097152| 100|0.13611582| PASSED 14 | diehard_opso| 0| 2097152| 100|0.27378190| PASSED 15 | diehard_oqso| 0| 2097152| 100|0.76970128| PASSED 16 | diehard_dna| 0| 2097152| 100|0.39648133| PASSED 17 | diehard_count_1s_str| 0| 256000| 100|0.13229106| PASSED 18 | diehard_count_1s_byt| 0| 256000| 100|0.52284713| PASSED 19 | diehard_parking_lot| 0| 12000| 100|0.90953203| PASSED 20 | diehard_2dsphere| 2| 8000| 100|0.99101009| PASSED 21 | diehard_3dsphere| 3| 4000| 100|0.11686236| PASSED 22 | diehard_squeeze| 0| 100000| 100|0.95129219| PASSED 23 | diehard_sums| 0| 100| 100|0.07830593| PASSED 24 | diehard_runs| 0| 100000| 100|0.70335337| PASSED 25 | diehard_runs| 0| 100000| 100|0.43055772| PASSED 26 | diehard_craps| 0| 200000| 100|0.78979510| PASSED 27 | diehard_craps| 0| 200000| 100|0.67957878| PASSED 28 | marsaglia_tsang_gcd| 0| 10000000| 100|0.55639343| PASSED 29 | marsaglia_tsang_gcd| 0| 10000000| 100|0.26195039| PASSED 30 | sts_monobit| 1| 100000| 100|0.50085266| PASSED 31 | sts_runs| 2| 100000| 100|0.46434749| PASSED 32 | sts_serial| 1| 100000| 100|0.85403800| PASSED 33 | sts_serial| 2| 100000| 100|0.50360214| PASSED 34 | sts_serial| 3| 100000| 100|0.97450300| PASSED 35 | sts_serial| 3| 100000| 100|0.83811604| PASSED 36 | sts_serial| 4| 100000| 100|0.15687493| PASSED 37 | sts_serial| 4| 100000| 100|0.09584866| PASSED 38 | sts_serial| 5| 100000| 100|0.50689925| PASSED 39 | sts_serial| 5| 100000| 100|0.42833102| PASSED 40 | sts_serial| 6| 100000| 100|0.55009400| PASSED 41 | sts_serial| 6| 100000| 100|0.40125608| PASSED 42 | sts_serial| 7| 100000| 100|0.80372569| PASSED 43 | sts_serial| 7| 100000| 100|0.39126036| PASSED 44 | sts_serial| 8| 100000| 100|0.93090048| PASSED 45 | sts_serial| 8| 100000| 100|0.53652823| PASSED 46 | sts_serial| 9| 100000| 100|0.05635399| PASSED 47 | sts_serial| 9| 100000| 100|0.09426552| PASSED 48 | sts_serial| 10| 100000| 100|0.61542855| PASSED 49 | sts_serial| 10| 100000| 100|0.75870498| PASSED 50 | sts_serial| 11| 100000| 100|0.22479095| PASSED 51 | sts_serial| 11| 100000| 100|0.17505036| PASSED 52 | sts_serial| 12| 100000| 100|0.15953170| PASSED 53 | sts_serial| 12| 100000| 100|0.68282318| PASSED 54 | sts_serial| 13| 100000| 100|0.27128012| PASSED 55 | sts_serial| 13| 100000| 100|0.67430985| PASSED 56 | sts_serial| 14| 100000| 100|0.45026149| PASSED 57 | sts_serial| 14| 100000| 100|0.58731583| PASSED 58 | sts_serial| 15| 100000| 100|0.73761832| PASSED 59 | sts_serial| 15| 100000| 100|0.79368617| PASSED 60 | sts_serial| 16| 100000| 100|0.93128522| PASSED 61 | sts_serial| 16| 100000| 100|0.95282449| PASSED 62 | rgb_bitdist| 1| 100000| 100|0.07643904| PASSED 63 | rgb_bitdist| 2| 100000| 100|0.34055380| PASSED 64 | rgb_bitdist| 3| 100000| 100|0.09497919| PASSED 65 | rgb_bitdist| 4| 100000| 100|0.20337859| PASSED 66 | rgb_bitdist| 5| 100000| 100|0.79883347| PASSED 67 | rgb_bitdist| 6| 100000| 100|0.78326688| PASSED 68 | rgb_bitdist| 7| 100000| 100|0.99471069| PASSED 69 | rgb_bitdist| 8| 100000| 100|0.08959948| PASSED 70 | rgb_bitdist| 9| 100000| 100|0.21891648| PASSED 71 | rgb_bitdist| 10| 100000| 100|0.07890571| PASSED 72 | rgb_bitdist| 11| 100000| 100|0.40564868| PASSED 73 | rgb_bitdist| 12| 100000| 100|0.48165709| PASSED 74 | rgb_minimum_distance| 2| 10000| 1000|0.37372397| PASSED 75 | rgb_minimum_distance| 3| 10000| 1000|0.92799240| PASSED 76 | rgb_minimum_distance| 4| 10000| 1000|0.74187551| PASSED 77 | rgb_minimum_distance| 5| 10000| 1000|0.00906188| PASSED 78 | rgb_permutations| 2| 100000| 100|0.25534804| PASSED 79 | rgb_permutations| 3| 100000| 100|0.97243740| PASSED 80 | rgb_permutations| 4| 100000| 100|0.62362666| PASSED 81 | rgb_permutations| 5| 100000| 100|0.85229815| PASSED 82 | rgb_lagged_sum| 0| 1000000| 100|0.62930801| PASSED 83 | rgb_lagged_sum| 1| 1000000| 100|0.97130458| PASSED 84 | rgb_lagged_sum| 2| 1000000| 100|0.21589015| PASSED 85 | rgb_lagged_sum| 3| 1000000| 100|0.95398372| PASSED 86 | rgb_lagged_sum| 4| 1000000| 100|0.04312164| PASSED 87 | rgb_lagged_sum| 5| 1000000| 100|0.60161304| PASSED 88 | rgb_lagged_sum| 6| 1000000| 100|0.41735375| PASSED 89 | rgb_lagged_sum| 7| 1000000| 100|0.54761117| PASSED 90 | rgb_lagged_sum| 8| 1000000| 100|0.61428627| PASSED 91 | rgb_lagged_sum| 9| 1000000| 100|0.12177281| PASSED 92 | rgb_lagged_sum| 10| 1000000| 100|0.68749039| PASSED 93 | rgb_lagged_sum| 11| 1000000| 100|0.64840747| PASSED 94 | rgb_lagged_sum| 12| 1000000| 100|0.78286297| PASSED 95 | rgb_lagged_sum| 13| 1000000| 100|0.92755032| PASSED 96 | rgb_lagged_sum| 14| 1000000| 100|0.17627587| PASSED 97 | rgb_lagged_sum| 15| 1000000| 100|0.57129755| PASSED 98 | rgb_lagged_sum| 16| 1000000| 100|0.40077409| PASSED 99 | rgb_lagged_sum| 17| 1000000| 100|0.39027921| PASSED 100 | rgb_lagged_sum| 18| 1000000| 100|0.51526271| PASSED 101 | rgb_lagged_sum| 19| 1000000| 100|0.89077389| PASSED 102 | rgb_lagged_sum| 20| 1000000| 100|0.74629101| PASSED 103 | rgb_lagged_sum| 21| 1000000| 100|0.23302093| PASSED 104 | rgb_lagged_sum| 22| 1000000| 100|0.91935393| PASSED 105 | rgb_lagged_sum| 23| 1000000| 100|0.06775498| PASSED 106 | rgb_lagged_sum| 24| 1000000| 100|0.73408955| PASSED 107 | rgb_lagged_sum| 25| 1000000| 100|0.17938749| PASSED 108 | rgb_lagged_sum| 26| 1000000| 100|0.03463808| PASSED 109 | rgb_lagged_sum| 27| 1000000| 100|0.99591334| WEAK 110 | rgb_lagged_sum| 27| 1000000| 200|0.54485298| PASSED 111 | rgb_lagged_sum| 28| 1000000| 100|0.03416641| PASSED 112 | rgb_lagged_sum| 29| 1000000| 100|0.20965074| PASSED 113 | rgb_lagged_sum| 30| 1000000| 100|0.15656891| PASSED 114 | rgb_lagged_sum| 31| 1000000| 100|0.44684361| PASSED 115 | rgb_lagged_sum| 32| 1000000| 100|0.14773107| PASSED 116 | rgb_kstest_test| 0| 10000| 1000|0.26012324| PASSED 117 | dab_bytedistrib| 0| 51200000| 1|0.70075707| PASSED 118 | dab_dct| 256| 50000| 1|0.83560449| PASSED 119 | Preparing to run test 207. ntuple = 0 120 | dab_filltree| 32| 15000000| 1|0.02268445| PASSED 121 | dab_filltree| 32| 15000000| 1|0.86399484| PASSED 122 | Preparing to run test 208. ntuple = 0 123 | dab_filltree2| 0| 5000000| 1|0.71379205| PASSED 124 | dab_filltree2| 1| 5000000| 1|0.52860798| PASSED 125 | Preparing to run test 209. ntuple = 0 126 | dab_monobit2| 12| 65000000| 1|0.68391861| PASSED -------------------------------------------------------------------------------- /tests/SmallCrush.txt: -------------------------------------------------------------------------------- 1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 | Starting SmallCrush 3 | Version: TestU01 1.2.3 4 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5 | 6 | 7 | *********************************************************** 8 | HOST = Preeths-MBP.lan, Darwin 9 | 10 | adam 11 | 12 | 13 | smarsa_BirthdaySpacings test: 14 | ----------------------------------------------- 15 | N = 1, n = 5000000, r = 0, d = 1073741824, t = 2, p = 1 16 | 17 | 18 | Number of cells = d^t = 1152921504606846976 19 | Lambda = Poisson mean = 27.1051 20 | 21 | 22 | ---------------------------------------------------- 23 | Total expected number = N*Lambda : 27.11 24 | Total observed number : 36 25 | p-value of test : 0.06 26 | 27 | 28 | ----------------------------------------------- 29 | CPU time used : 00:00:09.57 30 | 31 | Generator state: 32 | 33 | 34 | 35 | 36 | *********************************************************** 37 | Test sknuth_Collision calling smultin_Multinomial 38 | 39 | *********************************************************** 40 | HOST = Preeths-MBP.lan, Darwin 41 | 42 | adam 43 | 44 | 45 | smultin_Multinomial test: 46 | ----------------------------------------------- 47 | N = 1, n = 5000000, r = 0, d = 65536, t = 2, 48 | Sparse = TRUE 49 | 50 | GenerCell = smultin_GenerCellSerial 51 | Number of cells = d^t = 4294967296 52 | Expected number per cell = 1 / 858.99346 53 | EColl = n^2 / (2k) = 2910.383046 54 | Hashing = TRUE 55 | 56 | Collision test, Mu = 2909.2534, Sigma = 53.8957 57 | 58 | ----------------------------------------------- 59 | Test Results for Collisions 60 | 61 | Expected number of collisions = Mu : 2909.25 62 | Observed number of collisions : 2890 63 | p-value of test : 0.63 64 | 65 | ----------------------------- 66 | Total number of cells containing j balls 67 | 68 | j = 0 : 4289970186 69 | j = 1 : 4994222 70 | j = 2 : 2886 71 | j = 3 : 2 72 | j = 4 : 0 73 | j = 5 : 0 74 | 75 | ----------------------------------------------- 76 | CPU time used : 00:00:10.21 77 | 78 | Generator state: 79 | 80 | 81 | 82 | 83 | *********************************************************** 84 | HOST = Preeths-MBP.lan, Darwin 85 | 86 | adam 87 | 88 | 89 | sknuth_Gap test: 90 | ----------------------------------------------- 91 | N = 1, n = 200000, r = 22, Alpha = 0, Beta = 0.00390625 92 | 93 | 94 | ----------------------------------------------- 95 | Number of degrees of freedom : 1114 96 | Chi-square statistic : 1039.98 97 | p-value of test : 0.94 98 | 99 | ----------------------------------------------- 100 | CPU time used : 00:00:45.51 101 | 102 | Generator state: 103 | 104 | 105 | 106 | 107 | *********************************************************** 108 | HOST = Preeths-MBP.lan, Darwin 109 | 110 | adam 111 | 112 | 113 | sknuth_SimpPoker test: 114 | ----------------------------------------------- 115 | N = 1, n = 400000, r = 24, d = 64, k = 64 116 | 117 | 118 | ----------------------------------------------- 119 | Number of degrees of freedom : 19 120 | Chi-square statistic : 18.03 121 | p-value of test : 0.52 122 | 123 | ----------------------------------------------- 124 | CPU time used : 00:00:22.98 125 | 126 | Generator state: 127 | 128 | 129 | 130 | 131 | *********************************************************** 132 | HOST = Preeths-MBP.lan, Darwin 133 | 134 | adam 135 | 136 | 137 | sknuth_CouponCollector test: 138 | ----------------------------------------------- 139 | N = 1, n = 500000, r = 26, d = 16 140 | 141 | 142 | ----------------------------------------------- 143 | Number of degrees of freedom : 44 144 | Chi-square statistic : 38.60 145 | p-value of test : 0.70 146 | 147 | ----------------------------------------------- 148 | CPU time used : 00:00:22.37 149 | 150 | Generator state: 151 | 152 | 153 | 154 | 155 | *********************************************************** 156 | HOST = Preeths-MBP.lan, Darwin 157 | 158 | adam 159 | 160 | 161 | sknuth_MaxOft test: 162 | ----------------------------------------------- 163 | N = 1, n = 2000000, r = 0, d = 100000, t = 6 164 | 165 | Number of categories = 100000 166 | Expected number per category = 20.00 167 | 168 | 169 | ----------------------------------------------- 170 | Number of degrees of freedom : 99999 171 | Chi-square statistic :99467.30 172 | p-value of test : 0.88 173 | 174 | 175 | ----------------------------------------------- 176 | Anderson-Darling statistic : 0.78 177 | p-value of test : 0.22 178 | 179 | 180 | ----------------------------------------------- 181 | CPU time used : 00:00:10.93 182 | 183 | Generator state: 184 | 185 | 186 | 187 | 188 | *********************************************************** 189 | HOST = Preeths-MBP.lan, Darwin 190 | 191 | adam 192 | 193 | 194 | svaria_WeightDistrib test: 195 | ----------------------------------------------- 196 | N = 1, n = 200000, r = 27, k = 256, Alpha = 0, Beta = 0.125 197 | 198 | 199 | ----------------------------------------------- 200 | Number of degrees of freedom : 41 201 | Chi-square statistic : 45.74 202 | p-value of test : 0.28 203 | 204 | ----------------------------------------------- 205 | CPU time used : 00:00:45.90 206 | 207 | Generator state: 208 | 209 | 210 | 211 | 212 | *********************************************************** 213 | HOST = Preeths-MBP.lan, Darwin 214 | 215 | adam 216 | 217 | 218 | smarsa_MatrixRank test: 219 | ----------------------------------------------- 220 | N = 1, n = 20000, r = 20, s = 10, L = 60, k = 60 221 | 222 | 223 | ----------------------------------------------- 224 | Number of degrees of freedom : 3 225 | Chi-square statistic : 11.74 226 | p-value of test : 8.3e-3 227 | 228 | ----------------------------------------------- 229 | CPU time used : 00:00:06.65 230 | 231 | Generator state: 232 | 233 | 234 | 235 | 236 | *********************************************************** 237 | HOST = Preeths-MBP.lan, Darwin 238 | 239 | adam 240 | 241 | 242 | sstring_HammingIndep test: 243 | ----------------------------------------------- 244 | N = 1, n = 500000, r = 20, s = 10, L = 300, d = 0 245 | 246 | 247 | 248 | Counters with expected numbers >= 10 249 | ----------------------------------------------- 250 | Number of degrees of freedom : 2209 251 | Chi-square statistic : 2170.41 252 | p-value of test : 0.72 253 | 254 | ----------------------------------------------- 255 | CPU time used : 00:00:26.62 256 | 257 | Generator state: 258 | 259 | 260 | 261 | 262 | *********************************************************** 263 | HOST = Preeths-MBP.lan, Darwin 264 | 265 | adam 266 | 267 | 268 | swalk_RandomWalk1 test: 269 | ----------------------------------------------- 270 | N = 1, n = 1000000, r = 0, s = 30, L0 = 150, L1 = 150 271 | 272 | 273 | 274 | ----------------------------------------------- 275 | Test on the values of the Statistic H 276 | 277 | Number of degrees of freedom : 52 278 | ChiSquare statistic : 59.68 279 | p-value of test : 0.22 280 | 281 | 282 | ----------------------------------------------- 283 | Test on the values of the Statistic M 284 | 285 | Number of degrees of freedom : 52 286 | ChiSquare statistic : 56.01 287 | p-value of test : 0.33 288 | 289 | 290 | ----------------------------------------------- 291 | Test on the values of the Statistic J 292 | 293 | Number of degrees of freedom : 75 294 | ChiSquare statistic : 78.36 295 | p-value of test : 0.37 296 | 297 | 298 | ----------------------------------------------- 299 | Test on the values of the Statistic R 300 | 301 | Number of degrees of freedom : 44 302 | ChiSquare statistic : 37.55 303 | p-value of test : 0.74 304 | 305 | 306 | ----------------------------------------------- 307 | Test on the values of the Statistic C 308 | 309 | Number of degrees of freedom : 26 310 | ChiSquare statistic : 16.56 311 | p-value of test : 0.92 312 | 313 | 314 | ----------------------------------------------- 315 | CPU time used : 00:00:04.84 316 | 317 | Generator state: 318 | 319 | 320 | 321 | 322 | 323 | ========= Summary results of SmallCrush ========= 324 | 325 | Version: TestU01 1.2.3 326 | Generator: adam 327 | Number of statistics: 15 328 | Total CPU time: 00:03:25.61 329 | 330 | All tests were passed 331 | 332 | 333 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
  2 | 

3 | █ ▀██▀▀█▄ █ ▀██ ██▀ 4 | ███ ██ ██ ███ ███ ███ 5 | █ ██ ██ ██ █ ██ █▀█▄▄▀██ 6 | ▄▀▀▀▀█▄ ██ ██ ▄▀▀▀▀█▄ █ ▀█▀ ██ 7 | ▄█▄ ▄██▄ ▄██▄▄▄█▀ ▄█▄ ▄██▄ ▄█▄ █ ▄██▄ 8 | 9 | v0.11.0 10 | 11 | Chaos based random number generation 12 | Use at your own risk. Criticism and suggestions are welcome 13 |

14 | 15 | ADAM is an actively developed cryptographically secure pseudorandom number generator (CSPRNG) originally inspired by [ISAAC64](http://burtleburtle.net/bob/rand/isaacafa.html). It couples a chaotic function with elements of ISAAC’s logic to efficiently produce random bits with strong cryptographic properties. ADAM is available as both a command line tool and library. 16 | 17 | Also, just like ISAAC, ADAM is a backronym that describes its operations: 18 | 19 | **A** ccumulate a set of chaotic seeds
20 | **D** iffuse the work buffer with logic from ISAAC
21 | **A** pply the chaotic function
22 | **M** ix the work and state buffers to produce the output vector 23 | 24 | For a full breakdown of how ADAM itself works, see [ALGORITHM.md](ALGORITHM.md).
25 | For information on testing, see [TESTING.md](TESTING.md). 26 | 27 | ## TABLE OF CONTENTS 28 | 1. [Features](#features) 29 | 2. [Installation](#install) 30 | 3. [Command Line](#cli) 31 | 4. [Library](#lib) 32 | 5. [Security](#secure) 33 | 6. [Testing](#test) 34 | 7. [Contributing](#contrib) 35 | 36 | ## FEATURES 37 | 38 | - Statespace: 2¹⁷²⁵⁶ 39 | - Minimum cycle length (period) is ≥ 2²⁵⁶, probably much higher 40 | - Multi-cyclic 41 | - Avoids brute force and differential attacks 42 | - Two (optional) input parameters: one 256-bit seed and one 96-bit nonce 43 | - Space Complexity: O(N) 44 | - Raw RNG Implementation Size: 8544 bytes 45 | - Output sequence is irreversible 46 | - Natively examine statistical properties of a generated sequence with the in-house test suite 47 | - Easy interface for bit generation in both ASCII and binary form. Output up to 100GB at a time. 48 | - Alternatively, stream bits directly to the `stdin` of your own programs, RNG test suites, etc. 49 | - Extract different widths of integers from the buffer in decimal, hexadecimal, or octal format 50 | - Generate RFC 4122 compliant UUIDs 51 | - View generated integers with your width of choice 52 | - Uses SIMD acceleration where applicable (ARM NEON, AVX/AVX2, or AVX-512F) 53 | - User-friendly API definitions for usage as a library 54 | - Floating point number generation, with configurable precision for output and scaling factor support 55 | - Generate up to 1 billion integers/doubles per API call 56 | - Passes all empirical test suites that I am aware of 57 | 58 | ### Coming Soon! 59 | - FFI bindings! 60 | - Benchmarks! 61 | - More test results! 62 | - Pre-compiled binaries? 63 | - Some more native tests? 64 | - Multi-threading the examination test suite? 65 | 66 | ## INSTALLATION 67 | 68 | ADAM was developed for 64-bit ARM systems and requires clang or gcc. Support for NEON intrinsics (ARMv8.4-A or newer) with the `+crypto` and `+sha3` extensions is also required. 69 | 70 | By default the executable, library, and header will be available in `./build` but you can change this by tweaking the `BUILD_DIR` variable in the Makefile. 71 | 72 | ``` 73 | git clone https://github.com/pre-eth/adam.git 74 | cd adam 75 | make 76 | cd build 77 | ./adam -h 78 | ``` 79 | 80 | And you should be good to go! 81 | 82 | ## COMMAND LINE 83 | 84 | If you run `adam` with no arguments, you will get one randomly generated unsigned 64-bit number. 85 | 86 | Here's the full command summary: 87 | 88 |
 89 |      adam [-h|-v|-a|-b] [-i[filename?]] [-xof] [-w width] [-m multiplier] [-p precision]
 90 |           [-e multiplier] [-r results] [-u[amount?]]
 91 | 
 92 |                                               [OPTIONS]
 93 | 
 94 |      -h     Get command summary and all available options
 95 |      -v     Version of this software (v0.11.0)
 96 |      -i     Get the input parameters for the last run, or provide your own using a filename.
 97 |      -u     Generate a universally unique identifier (UUID). Optionally specify a number of UUID's
 98 |             to generate (max 1000)
 99 |      -r     The amount of numbers to generate and return, written to stdout. Must be within [1,
100 |             1000]
101 |      -w     Desired alternative size (u8, u16, u32) of returned numbers. Default width is u64
102 |      -b     Just bits... literally. Pass the -f flag beforehand to stream random doubles instead
103 |             of integers
104 |      -a     Write an ASCII or binary sample of bits/doubles to file for external assessment. You
105 |             can choose a multiplier to output up to 100GB of bits, or 1 billion doubles (with
106 |             optional scaling factor), at a time
107 |      -e     Examine a sample of 1MB with the ENT framework and some other statistical tests to
108 |             reveal properties of the output sequence. You can choose a multiplier within [1,
109 |             1000000] to examine up to 100GB at a time
110 |      -x     Print numbers in hexadecimal format with leading prefix
111 |      -o     Print numbers in octal format with leading prefix
112 |      -f     Enable floating point mode to generate doubles in (0.0, 1.0) instead of integers
113 |      -p     How many decimal places to print when printing doubles. Must be within [1, 15].
114 |             Default is 15
115 |      -m     Multiplier for randomly generated doubles, such that they fall in the range (0,
116 |             MULTIPLIER)
117 | 
118 | 119 | Not too hard to mess around with. Here's some basic examples, for reference: 120 | 121 | ### Generate 256 unsigned 64-bit integers and dump to stdout 122 | 123 | `adam -r 256` 124 | 125 | ### Generate and dump 500 unsigned 32-bit integers 126 | 127 | `adam -w 32 -r 500` 128 | 129 | ### Return 327 unsigned 32-bit integers in hexadecimal form 130 | 131 | `adam -w 32 -r 327 -x` 132 | 133 | ### Generate 12 UUIDs 134 | 135 | `adam -u12` 136 | 137 | ### Enable floating point mode to get a random double 138 | 139 | `adam -f` 140 | 141 | ### Enable floating point mode with 12 digits of precision 142 | 143 | `adam -p 12` 144 | 145 | **Note:** Setting the precision is enough to invoke floating point mode, so the -f option here would be redundant 146 | 147 | ### Examine a 1GB generated sequence 148 | 149 | `adam -e 1000` 150 | 151 | ### Get the input parameters for the last run 152 | 153 | `adam -i` 154 | 155 | ### Return 1000 integers in octal form 156 | 157 | `adam -r 1000 -o` 158 | 159 | ### Set the input parameters 160 | 161 | `adam -imyseed.bin` 162 | 163 | ### Pipe bits continuously to a program 164 | 165 | `adam -b | ./someprog` 166 | 167 | ### Generate a double within (0.0, 3000000000.0) 168 | 169 | `adam -m 3000000000` 170 | 171 | **Note:** Setting a scaling factor is enough to invoke floating point mode, so the -f option here would be redundant 172 | 173 | ### Generate 6 doubles within (0.0, 100.0) with 3 digits of precision 174 | 175 | `adam -m 100 -p 3 -r 6` 176 | 177 | ### Write 500MB of integer data to file in binary mode (interactive) 178 | 179 | ``` 180 | adam -a 181 | File name: testfile 182 | Output type (1 = ASCII, 2 = BINARY): 2 183 | Sequence Size (x 1MB): 500 184 | 185 | Generated 4000000000 bits and saved to testfile 186 | ``` 187 | 188 | ### Write 1000000 doubles between (0.0, 1.0) to file in ASCII mode (interactive) 189 | 190 | ``` 191 | adam -f -a 192 | File name: testfile_float 193 | Output type (1 = ASCII, 2 = BINARY): 1 194 | Sequence Size (x 1000): 1000 195 | 196 | Generated 1000000 doubles and saved to testfile_float 197 | ``` 198 | 199 | **Note:** When outputting doubles in ASCII mode, the current precision value is used when writing the doubles to file. 200 | 201 | ### Write 1000000 doubles between (0.0, 5000.0) to file in binary mode with specified seed (interactive) 202 | 203 | ``` 204 | adam -imyseed.bin -m 5000 -a 205 | File name: testfile_float5000 206 | Output type (1 = ASCII, 2 = BINARY): 2 207 | Sequence Size (x 1000): 1000 208 | 209 | Generated 1000000 doubles and saved to testfile_float5000 210 | ``` 211 | 212 | ## LIBRARY 213 | 214 | Aside from the CLI tool, you'll find `build/adam.h` and `build/libadam.a`, allowing you to integrate ADAM into your own code! 215 | 216 | The standard API is designed for those who don't want to write a lot of number handling boilerplate themselves and expect some basic quality-of-life functions. So this API has been designed for ergonomics and versatility. 217 | 218 | The standard API has 11 functions: 219 | 220 | ```c 221 | adam_data adam_setup(uint64_t *seed, uint32_t *nonce); 222 | int adam_reset(adam_data data, uint64_t *seed, uint32_t *nonce); 223 | int adam_record(adam_data data, uint64_t *seed, uint32_t *nonce); 224 | uint64_t adam_int(adam_data data, const NumWidth width); 225 | double adam_dbl(adam_data data, const uint64_t scale); 226 | int adam_fill(adam_data data, void *buf, const NumWidth width, const size_t amount); 227 | int adam_dfill(adam_data data, double *buf, const uint64_t multiplier, const size_t amount); 228 | void * adam_choice(adam_data data, void *arr, const size_t size); 229 | size_t adam_stream(adam_data data, const size_t amount, const char *file_name); 230 | void adam_cleanup(adam_data data); 231 | ``` 232 | 233 | The API is stable - new functions might be introduced, but these ones and their signatures will never change. 234 | 235 | Documentation will be available after compilation in `build/adam.h`. 236 | 237 | ## But is it REALLY secure? 238 | 239 | “Proving” security is a very difficult thing to do, and a good deal of cryptanalysis is needed before domain wide recognition for the strength of any cryptographic algorithm is gained. That’s why the saying [“Don’t Roll Your Own Crypto”](https://security.stackexchange.com/questions/18197/why-shouldnt-we-roll-our-own) exists. 240 | 241 | ADAM has passed the [NIST Test Suite for Random Bit Generation SP 800-22](https://csrc.nist.gov/publications/detail/sp/800-22/rev-1a/final) just like several other widely recognized CSPRNG algorithms, along with other more challenging test suites mentioned below. Up to 16TB (2⁴⁴ values) has been tested so far. However, conducting specialized cryptographic testing is required before confident security guarantees can be made. This is just a toy RNG for now, and for production use I strongly recommend using something more thoroughly vetted by the field like [ChaCha20](https://datatracker.ietf.org/doc/html/rfc7539). The next major goal for ADAM will be pursuing detailed crytographic validation and study. 242 | 243 | While passing one or even all of these test suites doesn't guarantee that a RNG is cryptographically secure, it follows that a CSPRNG will pass these tests, so they nonetheless provide a measuring stick of sorts to reveal flaws in the design and various characteristics of the randomness of the generated numbers. If you run these tests yourself, you might see false-positives that are retried or some p-values marked as "unusual" - this is to be expected and is a consequence of running many tests over and over, because if the output is really random, then there will inevitably be some weaker (but not concerningly defective) outcomes. 244 | 245 | The key things to look for are: 246 | - The output is completely unpredictable unless you know the input parameters, with no apparent bias. 247 | - Internal state cannot be reverse engineered from the output. 248 | - The statistical quality is high the overwhelming majority of the time (i.e. no consistently suspicious test results and *definitely* no hard failures, ever). 249 | - There is mathematical basis for at least some of the ideas behind the security proposition. 250 | - The security implications of the different design decisions are considered carefully, with proofs provided where needed. 251 | 252 | The CACert Research Lab provides a [public record](https://www.cacert.at/cgi-bin/rngresults) of the properties of different RNGS available today. You can see how ADAM stacks up against other RNGs from a naive run of ENT and Diehard. 253 | 254 | ## TESTING 255 | 256 | Testing is easy with the `-a` option. The minimum number of bits that can be outputted is 1MB. You can provide a multiplier within [1, 1000] as mentioned above, and then write those bits to a text or binary file which can be supplied to any of the testing frameworks listed below, a different framework, or your own RNG tests! 257 | 258 | For piping data directly into a testing program, use the `-b` option. To see other testing details, please refer to [TESTING.md](TESTING.md). Sample results are available in the [tests](tests) directory, with the exception of ENT because it's built into the `-e` option. 259 | 260 | ## CONTRIBUTING 261 | 262 | I started ADAM after looking at the source of ISAAC while I was learning C. I didn't intend to make anything groundbreaking or crazy, but I'm open to all cryptanalysis that can increase the cryptographic strength of this generator. Feel free to reach out to me or open an issue for any ideas/critiques/statistics you may have that can improve the implementation. 263 | 264 | As far as code contributions though, I'd like to maintain the project myself for now as a continued learning opportunity. If I open the codebase up in the future I will amend the README, but as of now I'm not looking for other developers. 265 | 266 | 267 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # ADAM - TESTING 2 | 3 | Everything you need to know for testing ADAM with different popular RNG test suites. 4 | 5 | Click on a test to learn more. 6 | 7 | | Status | Name | Description | 8 | | ------------------| ----------- | ----------- | 9 | | ✅ **PASS** | [ent](https://www.fourmilab.ch/random) | Calculates various values for a supplied pseudo random sequence like entropy, arithmetic mean, Monte Carlo value for pi, and more. Included with the CLI tool 10 | | ✅ **PASS** | [NIST STS](https://csrc.nist.gov/projects/random-bit-generation/documentation-and-software) | Set of statistical tests of randomness for generators intended for cryptographic applications. The general standard. 11 | | ✅ **PASS** | [Dieharder](https://webhome.phy.duke.edu/~rgb/General/dieharder.php) | Cleaned up version of George Marsaglia's DIEHARD suite plus the STS tests from above and RGB tests. Mostly of historical interest. 12 | | ✅ **PASS** | [testunif - gjrand](https://gjrand.sourceforge.net) | Extensive tests not within DIEHARD or NIST that analyze the randomness of bit sequences. Very particular and supposedly pretty tough! 13 | | ✅ **PASS** | [testfunif - gjrand](https://gjrand.sourceforge.net) | Another series of tests specifically for analyzing the uniformity of double precision floating point numbers in [0.0, 1.0). 14 | | ✅ **PASS** | [CACert](https://www.cacert.at/cgi-bin/rngresults) | Cryptographic certificate provider that maintains test results of various RNGs. ADAM is among the top 8 crypto RNG entries which had a flawless test run. 15 | | ✅ **PASS** | [Rabbit - TestU01](http://simul.iro.umontreal.ca/testu01/tu01.html) | For analyzing bitstreams. Treats input as one large binary sequence and applies 40 different statistical tests. 16 | | ✅ **PASS** | [SmallCrush - TestU01](http://simul.iro.umontreal.ca/testu01/tu01.html) | 10 different tests. Small but effective at spotting deficiencies missed by other test suites. Lots of good generators fail this one. 17 | | ✅ **PASS** | [Crush - TestU01](http://simul.iro.umontreal.ca/testu01/tu01.html) | 96 different tests. Very thorough and stringent, requires around 2³⁵ numbers in total. 18 | | ✅ **PASS** | [BigCrush - TestU01](http://simul.iro.umontreal.ca/testu01/tu01.html) | 106 different tests. Even more stringent, requires "close to" 2³⁸ numbers in total. 19 | | ✅ **PASS** | [PractRand](https://sourceforge.net/projects/pracrand/) | Final Boss - The most rigorous and effective test suite for PRNGs available. Can test unlimited lengths of sequences - ADAM has been tested up to 16TB! 20 | 21 | ## adam -e 22 | 23 | This is a collection of miscellaneous heuristics and empirical tests implemented by me, just for reporting some notable properties of an output sequence to the user. It's nowhere near as important as the feedback from tried and true testing suites, but it's good for some quick information about the sequences you generate. 24 | 25 | Additionally, the [ENT](https://www.fourmilab.ch/random/) framework is integrated into this collection, for a total of 23 pieces of information that are returned to the user: 26 | 27 | - Total sequences generated (also reported in terms of numbers generated per width) 28 | - Monobit frequency (including bit runs and longest runs of 0s/1s) 29 | - Seed & Nonce 30 | - Range distribution 31 | - Max and min values 32 | - Parity: even and odd number ratio 33 | - Runs: total # of runs and longest run (increasing/decreasing) 34 | - Average gap length 35 | - Most and least common bytes 36 | - 64-bit floating point frequency + average FP value + distribution 37 | - 64-bit floating point permutations + total permutations + standard deviation 38 | - 32-bit floating point Max-of-8 test + total sets + most/least common position 39 | - Entropy (ENT) 40 | - Chi-square (ENT) 41 | - Arithmetic mean (ENT) 42 | - Monte Carlo value for pi (ENT) 43 | - Serial correlation (ENT) 44 | - 4-bit [Saturation Point Test](https://dergipark.org.tr/en/pub/ijiss/issue/16060/167857) 45 | - 8-bit [Maurer Universal Test](https://link.springer.com/article/10.1007/BF00193563) 46 | - 16-bit [Topological Binary Test](https://www.researchgate.net/publication/288404484_A_New_Randomness_Test_for_Bit_Sequences) 47 | - 32-bit [Von Neumann Successive Difference Test](https://projecteuclid.org/journals/annals-of-mathematical-statistics/volume-12/issue-4/Distribution-of-the-Ratio-of-the-Mean-Square-Successive-Difference/10.1214/aoms/1177731677.full?tab=ArticleFirstPage) 48 | - 64-bit [SAC Test](https://www.researchgate.net/publication/222525312_The_strict_avalanche_criterion_randomness_test) 49 | - 128-bit [Walsh-Hadamard Transform Test](https://www.semanticscholar.org/paper/WALSH-HADAMARD-RANDOMNESS-TEST-AND-NEW-METHODS-OF-Oprina-Popescu/42de0c0c663461bfded8e5b29171e40f34ffed85) 50 | 51 | ## NIST 52 | 53 | The STS can be downloaded [here](https://csrc.nist.gov/projects/random-bit-generation/documentation-and-software). [This](https://www.slideshare.net/Muhammadhamid23/running-of-nist-test-109375052) is a good little quick start guide. 54 | 55 | Results for testing 10MB, 100MB, 500MB, and 1GB are available in the `tests` subdirectory. Sequences above 1GB weren't tested because based off my reading, the NIST STS struggles with performance and accuracy issues for very large sequences. 56 | 57 | Some results for the NonOverlappingTemplate tests may be borderline - this is expected since the output should be random, which means some runs will probability wise be weaker than others. The overall is what's most important, and to confirm for yourself you can run the Dieharder test suite which includes the STS tests and retries any `WEAK` results until a conclusive verdict can be reached. 58 | 59 | NIST has created a [manual](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-22r1a.pdf) detailing each of the different tests, available for free download. 60 | 61 | ## Dieharder 62 | 63 | `adam -b | dieharder -a -Y 1 -k 2 -g 200` 64 | 65 | Explanation of options can be found in Dieharder's [man page](https://linux.die.net/man/1/dieharder). I couldn't get the Dieharder binary working on macOS, so unfortunately this test may be limited to Linux users, unless you try using a Docker container (if I'm wrong please let me know). 66 | 67 | ## gjrand 68 | 69 | First download gjrand [here](https://gjrand.sourceforge.net), and then come back to this section. I tested on gjrand.4.3.0.0 so that's the version I'll proceed with. 70 | 71 | Using gjrand is easy but traversing it and figuring out what to build and how to build it is annoying so here's a quick little guide. 72 | 73 | ### testunif 74 | 75 | I recommend reading or skimming the `README.txt` file at the top level of this directory. It helps you understand the results. 76 | 77 | On Unix systems building the binary should just work, so run: 78 | 79 | ``` 80 | cd gjrand.4.3.0.0/testunif/src 81 | ./compile 82 | cd .. 83 | adam -b | ./mcp -- 84 | ``` 85 | 86 | where SIZE_OPTION is one of: 87 | 88 | ``` 89 | --tiny 10MB 90 | --small 100MB 91 | --standard 1GB 92 | --big 10GB 93 | --huge 100GB 94 | --tera 1TB 95 | --ten-tera 10TB 96 | ``` 97 | 98 | Results for sizes up to 100GB are available in the `tests` subdirectory. 99 | 100 | ### testfunif 101 | 102 | I recommend reading or skimming the `README.txt` file at the top level of this directory. 103 | 104 | To build and run: 105 | 106 | ``` 107 | cd gjrand.4.3.0.0/testfunif/src 108 | ./compile 109 | cd .. 110 | adam -f -a 111 | File name: ftest 112 | Output type (1 = ASCII, 2 = BINARY): 2 113 | Sequence Size (x 1000): 1500 114 | Scaling factor: 1 115 | ./mcpf --tiny < ftest 116 | ``` 117 | 118 | The size options are: 119 | 120 | ``` 121 | --tiny 1M doubles 122 | --small 10M doubles 123 | --standard 100M doubles (default) 124 | --big 1G doubles 125 | --huge 10G doubles 126 | --even-huger 100G doubles 127 | --tera 1T doubles. 128 | ``` 129 | 130 | Results for sizes up to 10G (10 billion) doubles are available in the `tests` subdirectory. 131 | 132 | Finally, here is a summary of the meaning of gjrand's P-values. 133 | 134 | ``` 135 | The one-sided P-value is supposed to be a "single figure of merit" that 136 | summarises a test result for people in a hurry. It doesn't usually encapsulate 137 | all the information found by a particular test. Instead it usually focuses on 138 | the most common or most serious failure modes. Some tests produce several 139 | other results before the P-value, and these are worth reading and 140 | understanding if you really want to know what's going on. In many cases the 141 | actual tests are two-sided. But the P-value reported will always be one-sided. 142 | Some are not very accurate, but should be close enough to support the rough 143 | guide to interpretation below. 144 | 145 | Interpretation of one-sided P-values. 146 | 147 | P > 0.1 : This P-value is completely ok. Don't try to compare 148 | P-values in this range. "0.9 is higher than 0.4 so 0.9 must 149 | be better." Wrong. "0.5 is better than 0.999 because 0.5 is 150 | right in the middle of the range and therefore more random." 151 | Wrong. Each one-sided P-value test was designed to return an 152 | almost arbitrary value P > 0.1 if no bad behaviour was detected. 153 | If P > 0.1, you know no bad behaviour was detected, and you shouldn't 154 | try to interpret the result as anything more than that. 155 | Of course, a good P value like this doesn't prove the generator is 156 | good. It is always possible trouble will be spotted with a 157 | different test, or more data. 158 | 159 | P <= 0.1 : There might be some cause for concern. In this range, 160 | the lower P is, the worse it is. 161 | 162 | 0.001 < P <= 0.1 : Not really proof that anything is wrong, but reason for 163 | vague suspicion. Further testing with a different random seed 164 | and perhaps larger data size is recommended. If a generator ALWAYS 165 | produces P values in this range or lower for a particular test, 166 | after many runs with different seeds, then it's probably broken. 167 | 168 | 1.0e-6 < P <= 0.001 : Like above, but moreso. Here you should start to worry. 169 | 170 | 1.0e-12 < P <= 1.0e-6 : There is a very remote possiblility that the 171 | generator is ok, but you should be seriously worried. After you 172 | see a P value this low, you can only rehabilitate the generator 173 | if you run the test that failed for many different seeds and 174 | it repeatedly produces good P-values with no more seriously bad ones. 175 | 176 | P <= 1.0e-12 : You are most unlikely to see a good generator do this on a 177 | good test even once in your lifetime. You would be safe to reject any 178 | generator that does this on a properly calibrated test. 179 | ``` 180 | 181 | **Note:** For the next two test suites, I assume you've cloned the [testingRNG](https://github.com/lemire/testingRNG) repository. 182 | 183 | ## TestU01 184 | 185 | To build from the root of `testingRNG`: 186 | 187 | ``` 188 | cd testu01 189 | make 190 | ``` 191 | 192 | You might get a linker error when trying to install the examples, but just scroll up and make sure you see something like "Libraries have been installed in ". Now there should be a folder named `build` present. 193 | 194 | Now, `cd` back to `build` in the ADAM directory: 195 | 196 | ``` 197 | cp ./libadam.a /build/lib/libadam.a 198 | cp ./adam.h /build/include/adam.h 199 | ``` 200 | 201 | Where is replaced with the path of the top-level TestU01 folder respectively on your system. Once you're done that, create a new C source file in `/build` with the following: 202 | 203 | ```c 204 | #include "include/TestU01.h" 205 | #include "include/adam.h" 206 | 207 | static adam_data data; 208 | 209 | unsigned int adam_get(void) 210 | { 211 | return adam_int(data, UINT32); 212 | } 213 | 214 | int main() 215 | { 216 | data = adam_setup(NULL, NULL); 217 | 218 | // Create TestU01 PRNG object for our generator 219 | unif01_Gen *gen = unif01_CreateExternGenBits("adam", adam_get); 220 | 221 | // Run the tests. 222 | bbattery_Crush(gen); 223 | 224 | // Clean up. 225 | unif01_DeleteExternGenBits(gen); 226 | adam_cleanup(data); 227 | 228 | return 0; 229 | } 230 | ``` 231 | 232 | TestU01 works with 32-bit data so we need to set the width parameter accordingly. Now compile and run (swap `crush.c` with the name of your file): 233 | 234 | ``` 235 | gcc -std=c99 -Wall -O3 -o crush crush.c -Iinclude -Llib -ltestu01 -lprobdist -lmylib -lm -ladam -march=native 236 | ./crush 237 | ``` 238 | 239 | Crush should start running if you did everything correctly. It will take a while. You can swap out Crush with other batteries easily by changing the `bbattery_Crush` function call to `bbattery_SmallCrush`, `bbattery_Rabbit`, etc. For more details about the test suite, consult the [guide](http://simul.iro.umontreal.ca/testu01/guideshorttestu01.pdf), which is also available in the `doc` folder. 240 | 241 | ## PractRand 242 | 243 | To build from the root of `testingRNG`: 244 | 245 | ``` 246 | cd practrand 247 | make 248 | ``` 249 | 250 | Then, assuming `adam` is in your path (if not, copy it to the build folder and replace the `adam` call below with `./adam`): 251 | 252 | `adam -b / ./RNG_test stdin8` 253 | 254 | Since ADAM's default work unit is 64-bits, `stdin8` is the right size value to pass according to the documentation. If you'd like to try testing at other integer widths though, go ahead! 255 | 256 | PractRand also includes a wealth of great documentation about its test results and thought processes. See any of the text files with the `Test_` prefix to learn more about how the tests work, how the author determines their results, their specific grading system, and the author's thoughts on the other test suites listed here. 257 | -------------------------------------------------------------------------------- /include/test.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_H 2 | #define TEST_H 3 | #include "defs.h" 4 | #include "ent.h" 5 | #include "api.h" 6 | 7 | /* NOTE: All critical values use an alpha level of 0.01 */ 8 | #define ALPHA_LEVEL 0.01 9 | #define STRICT_LEVEL 0.001 10 | #define TESTING_BITS 8011776ULL 11 | #define TESTING_DBL 1000ULL 12 | #define BITS_TESTING_LIMIT 1000000 13 | #define DBL_TESTING_LIMIT 1500000 14 | 15 | typedef struct basic_test { 16 | u64 seed[ADAM_SEED_SIZE / sizeof(u64)]; 17 | u32 nonce[ADAM_NONCE_SIZE / sizeof(u32)]; 18 | u64 sequences; 19 | u64 up_runs; 20 | u64 longest_up; 21 | u64 down_runs; 22 | u64 longest_down; 23 | double avg_gap; 24 | u64 mcb[5]; 25 | u64 lcb[5]; 26 | } basic_test; 27 | 28 | // FOR: Range distribution of output values 29 | #define RANGE_CAT 5 30 | #define RANGE_CRITICAL_VALUE 13.277 31 | #define RANGE_PROB1 2.328306436538696E-10 32 | #define RANGE_PROB2 5.937181414550612E-8 33 | #define RANGE_PROB3 0.000015199185323 34 | #define RANGE_PROB4 0.003891050583657 35 | #define RANGE_PROB5 0.996093690626375 36 | 37 | typedef struct range_test { 38 | u64 max; 39 | u64 min; 40 | u64 odd; 41 | u64 range_dist[RANGE_CAT]; 42 | } range_test; 43 | 44 | // FOR: Monobit frequency (bit distribution) 45 | #define MFREQ_CRITICAL_VALUE 6.635 46 | #define MFREQ_PROB 0.5 47 | 48 | typedef struct mfreq_test { 49 | u64 mfreq; 50 | u64 one_runs; 51 | u64 longest_one; 52 | u64 zero_runs; 53 | u64 longest_zero; 54 | } mfreq_test; 55 | 56 | // FOR: Floating point distribution upon converting integer output accordingly 57 | #define FPF_CAT 10 58 | #define FPF_CRITICAL_VALUE 21.666 59 | #define FPF_PROB (1.0 / 10.0) 60 | 61 | // FOR: Floating point permutations test 62 | #define FP_PERM_SIZE 5 63 | #define FP_PERM_CAT 120 // 5! 64 | #define FP_PERM_CRITICAL_VALUE 157.800 65 | #define FP_PERM_PROB (1.0 / 120.0) 66 | 67 | // FOR: Floating point max of T test (T = 8) 68 | #define FP_MAX_CAT 8 69 | #define FP_MAX_PROB 0.125 70 | #define FP_MAX_CRITICAL_VALUE 18.475 71 | 72 | typedef struct fp_test { 73 | double avg_fp; 74 | u64 perms; 75 | u64 fp_max_runs; 76 | u64 fpf_dist[FPF_CAT]; 77 | u64 fpf_quad[4]; 78 | u64 fp_perms[FP_PERM_CAT]; 79 | u64 fp_max_dist[FP_MAX_CAT]; 80 | } fp_test; 81 | 82 | /* 83 | FOR: 4-bit Saturation Point Test 84 | 85 | The Saturation Point Test is similar to the Coupon Collector's Test, where it sees how long of a 86 | sequence is required to get all the numbers in a set (in our case, 2^4 values), and logs the index 87 | where all such values appear (which is called the saturation point, or SP). It can be applied to 88 | a variable width of integers and analyze short sequences as opposed to requiring longer sequences 89 | like some other tests here. The implementation differs a bit from what's described in the paper for 90 | efficiency's sake, including p-value calculation as the author passes a value of 2 to the igamc() 91 | function used for calculating the p-value, where we can go one step further and directly pass 2.5 92 | since we have a version that accepts double inputs. However, the test still works as expected and 93 | ADAM meets all the expected values, including hovering right around the expected SP (50 vs 51). 94 | 95 | We gather all 4-bit quantities, record the SP value and then do a chi-square test for goodness of 96 | fit over the observed ranges of the SP values. The probabilities were directly provided by the 97 | author in the paper. 98 | 99 | Additionally, the raw chi-square, average SP, and overall distribution of values are reported. 100 | 101 | F. Sulak, “A New Statistical Randomness Test: Saturation Point Test”, IJISS, vol. 2, no. 3, 102 | pp. 81–85, 2013. 103 | */ 104 | #define SP_CAT 5 105 | #define SP_DIST 50 106 | #define SP_EXPECTED 51 107 | #define SP_K 4 108 | #define SP_OBS_MIN (1U << SP_K) 109 | #define SP_OBS_MAX 64 110 | #define SP_CRITICAL_VALUE 13.277 111 | #define SP_PROB1 0.193609 112 | #define SP_PROB2 0.179686 113 | #define SP_PROB3 0.196007 114 | #define SP_PROB4 0.195881 115 | #define SP_PROB5 0.234818 116 | 117 | /* 118 | FOR: 8-bit Maurer Universal Statistical Test 119 | 120 | The Maurer Universal Statistic is a great alternative/complement to other classic pseudorandom 121 | statistical tests like the frequency, runs, autocorrelation, and serial tests, but offers 2 very 122 | useful advantages over them. According to the paper: 123 | 124 | 1. Rather than being tailored to detecting a specific type of statistical defect, the test is able 125 | to detect any one of the very general class of statistical defects that can be modeled by an 126 | ergodic stationary source with finite memory, which includes all those detected by the tests 127 | discussed in the previous section and can reasonably be argued to comprise the possible defects 128 | that could realistically occur in a practical implementation of a random bit generator. 129 | 130 | 2. The test measures the actual amount by which the security of a cipher system would be reduced if 131 | the tested generator G were used as the key source, i.e., it measures the effective key size of a 132 | cipher system with key source G. Therefore, statistical defects are weighted according to the 133 | potential damage they would cause in a cryptographic application. 134 | 135 | The reason why I included this test is to provide more in-house tests for judging the cryptographic 136 | qualities of ADAM specifically, as opposed to some of the other tests which are just property reports 137 | and traditional PRNG tests that don't necessarily deduce anything about security. 138 | 139 | We analyze each 1MB sequence per the requested examination size, collect each p-value from the subtests 140 | using Fisher's method, and then get a final p-value from the Fisher's method statistic at the very end 141 | when reporting all test results and printing them. This makes the implementation even stronger, allowing 142 | us to conduct a meta-analysis of all the subtests to comb through the output sequence. 143 | 144 | Maurer, U.M. A universal statistical test for random bit generators. J. Cryptology 5, 89–105 (1992). 145 | https://doi.org/10.1007/BF00193563 146 | */ 147 | #define MAURER_ARR_SIZE 1001472 148 | #define MAURER_L 8 149 | #define MAURER_Q 2048 150 | #define MAURER_K (MAURER_ARR_SIZE - MAURER_Q) 151 | #define MAURER_C 0.603 152 | #define MAURER_Y 2.58 153 | #define MAURER_EXPECTED 7.1836656 154 | #define MAURER_VARIANCE 3.2386622 155 | #define MAURER_STD_DEV 1.7996283 156 | 157 | typedef struct maurer_test { 158 | u64 trials; 159 | double stat; 160 | u8 *bytes; 161 | u64 pass; 162 | double mean; 163 | double std_dev; 164 | double fisher; 165 | } maurer_test; 166 | 167 | /* 168 | FOR: 16-bit Topological Binary Test (TBT) 169 | 170 | The 16-bit TBT looks for the number of distinct 16-bit patterns per 2^16 patterns, where a "pattern" 171 | is a 16-bit block of bits. Once TBT_SEQ_SIZE patterns have been supplied, we see if the number of 172 | distinct numbers found is greater than or equal to TBT_CRITICAL_VALUE, and if so then we fail to 173 | reject the null hypothesis. 174 | 175 | The pass rate, average number of distinct patterns, and overall proportion are reported in addition 176 | to the target metrics from the original paper. While the paper specifies the discrete probability 177 | function allowing us to obtain a p-value, actually using the function for calculations proves very 178 | difficult due to the large values involved, especially the Stirling Numbers of the Second Kind. So 179 | only the collected results of each discrete outcome is reported. 180 | 181 | Alcover, Pedro & Guillamón, Antonio & Ruiz, M.D.C. (2013). A New Randomness Test for Bit Sequences. 182 | Informatica (Netherlands). 24. 339-356. 10.15388/Informatica.2013.399. 183 | */ 184 | #define TBT_M 16 185 | #define TBT_SEQ_SIZE (1UL << TBT_M) 186 | #define TBT_CRITICAL_VALUE 41241 187 | #define TBT_PROPORTION 0.629 188 | #define TBT_ARR_SIZE 1024 189 | 190 | typedef struct tb_test { 191 | u64 trials; 192 | u64 total_u16; 193 | double fisher; 194 | u64 prop_sum; 195 | u64 pass_rate; 196 | } tb_test; 197 | 198 | /* 199 | FOR: 32-bit Von Neumann's Successive Difference Test 200 | 201 | Simple implementation of a Von Neumann test for randomness that focuses on Mean Squared Successive 202 | Difference (MSSD). Sequences are processed 1MB at a time, and the Von Neumann Ratio calculation is 203 | applied using all 32-bit quantities in the sample. MSSD is an approximation of variance, and for 204 | random sequences will be close to/equal to the variance of the sample. Gradual shifts in mean of the 205 | numbers are accounted for while calculating a measure of variability for the sample, which can be easily 206 | converted to p-value after using the VN statistic to calculate the appropriate z-score. P-values are 207 | recorded with the same frequency as the Maurer test implementation, meaning the results scale nicely. 208 | 209 | An easy to implement, classic randomness test, so not much to say. The pass rate is reported as well. 210 | 211 | John von Neumann. "Distribution of the Ratio of the Mean Square Successive Difference to the Variance." 212 | Ann. Math. Statist. 12 (4) 367 - 395, December, 1941. https://doi.org/10.1214/aoms/1177731677 213 | */ 214 | #define VNT_N 250368 215 | #define VNT_MEAN 2.000007988273214 216 | #define VNT_STD_DEV 0.003997059246194 217 | 218 | typedef struct vn_test { 219 | u64 trials; 220 | double p_value; 221 | double fisher; 222 | u64 pass_rate; 223 | u64 pdist[10]; 224 | } vn_test; 225 | 226 | /* 227 | FOR: 64-bit Strict Avalanche Criterion (SAC) Test 228 | 229 | 64 different probabilities needed here so instead of polluting the header, see the function 230 | print_avalanche_results() in support.c. 231 | 232 | These probabilities were calculated from the binomial distribution using probability 0.5 as per 233 | the paper. We have 64 degrees of freedom for the 64 bits in each value. If at least 32 bits have 234 | not changed, then the test fails for that run. So we do this for the entire stream size: tally the 235 | Hamming distance between u64 numbers in the same buffer position per run, compute the expected 236 | count per bin for the size of this stream, then do a chi-square test for goodness of fit with the 237 | binomial distribution. The avalanche effect measures the difference in output when you change 238 | the inputs by 1 bit, so a copy of the adam_data struct that is passed to the test runner is assigned 239 | the same seed and nonce, but the nonce is incremented by 1. The resulting output between both is 240 | compared for the test, and as the original struct gets reseeded, its internal state is duplicated 241 | to the copy struct and the nonce is incremented again. So we get to conduct the SAC test for EACH 242 | iteration of the testing loop and collect all the results for the end! 243 | 244 | An interesting thing of note is that the binomial distribution with parameters B(0.5, n) will 245 | average out to n/2. So we use this knowledge to check how the distribution of Hamming distances 246 | we have recorded matches the given distribution. 247 | 248 | Additionally, the mean Hamming distance and observed distribution are reported as well. 249 | 250 | Hernandez-Castro, Julio & Sierra, José & Seznec, Andre & Izquierdo, Antonio & Ribagorda, Arturo. (2005). 251 | The strict avalanche criterion randomness test. Mathematics and Computers in Simulation. 68. 1-7. 252 | 10.1016/j.matcom.2004.09.001. 253 | */ 254 | #define AVALANCHE_CAT 4 255 | #define AVALANCHE_CRITICAL_VALUE 11.345 256 | 257 | /* 258 | FOR: 128-bit Walsh-Hadamard Transform Test 259 | 260 | The Walsh-Hadamard Transform (WHT) is a concept I had trouble understanding for a while especially 261 | since I don't have a background in stats or math, and I wasn't already familiar with the Discrete 262 | Fourier Transform either. But it seems like the basic idea is this: the WHT is a way to map the output 263 | of one function to a binary domain of [-1, 1] through a set of "basis functions." This transform is 264 | used a lot in areas like compression, quantum computing, and for our purposes, pseudorandom generation 265 | and cryptography. All the details and inner workings of the WHT aren't necessary to understand the 266 | test, but this is the foundational concept. 267 | 268 | This test works on 4 32-bit blocks per output sequence, where each sequence has 128 quantities of 128 bits. 269 | Each of the 4 blocks are converted to binary form, and the 32 bits are fed to the basis function: 270 | 271 | F(x) = 1 - 2x (where x is a one of the 32 bits, with value 0 or 1) 272 | 273 | This maps the 32-bit block's binary representation to another binary representation where each value is 274 | -1 or 1, and all those values are used in a summation AFTER each term is multplied with -1^(i • j), where 275 | j is the jth 32-bit block (aka the index of the currently transformed 32-bit number) and i is the index 276 | of the currently transformed bit (from 0-128). The dot product is done on the binary forms of i and j, so 277 | we just do a logical AND operation and then POPCNT to count the 1s. The summation result for the jth - 278 | (j + 4)th blocks (aka their Walsh-Hadamard transforms) are then summed together to create a 128-bit test 279 | statistic, which is squared and added to an accumulator for all 128 128-bit blocks we measure. Then, a 280 | p-value is then obtained from the statistic. We process 128-bits at a time because the paper specifies 281 | a processing size of 2^m for the transformation where m ≥ 7, as this is the minimum value for the normal 282 | distribution to be a good approximation of the WHT statistic. 283 | 284 | We combine all the p-values using Fisher's method just like above with the Maurer test, and report a 285 | final p-value with the rest of the examination results. We do multiple meta-combinations to ensure the 286 | accuracy doesn't drop off for large sequence values 287 | 288 | This test is used to detects a general class of randomness defects like frequency and autocorrelation 289 | failure. Another goal of this test is to answer to the question if the tested sequence is produced by 290 | some binary function. Additionally, it's used in testing several cryptographic criteria like correlation 291 | immunity, frequency balance, and strict avalanche. 292 | 293 | Additonally the number of passing runs and numbers, and distribution of p-values, are also reported. 294 | 295 | Oprina, Andrei-George et al. “WALSH-HADAMARD RANDOMNESS TEST AND NEW METHODS OF TEST RESULTS INTEGRATION.” 296 | (2009). 297 | */ 298 | #define WH_DF 128 299 | #define WH_CRITICAL_VALUE 168.133 300 | #define WH_STD_DEV 11.3137084 301 | #define WH_UPPER_BOUND 2.5758 302 | #define WH_LOWER_BOUND -2.5758 303 | 304 | typedef struct wh_test { 305 | u64 trials; 306 | double p_value; 307 | double fisher; 308 | u64 pass_seq; 309 | u64 pass_num; 310 | u64 dist[10]; 311 | } wh_test; 312 | 313 | typedef struct rng_test { 314 | basic_test *basic; 315 | range_test *range; 316 | mfreq_test *mfreq; 317 | fp_test *fp; 318 | maurer_test *mau; 319 | tb_test *topo; 320 | vn_test *von; 321 | wh_test *walsh; 322 | ent_test *ent; 323 | } rng_test; 324 | 325 | // https://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax 326 | #define MIN(a, b) (b ^ ((a ^ b) & -(a < b))) 327 | #define MAX(a, b) (a ^ ((a ^ b) & -(a < b))) 328 | 329 | void adam_examine(const u64 limit, adam_data_t data); 330 | double cephes_igamc(double a, double x); 331 | double po_zscore(double z_score); 332 | #endif -------------------------------------------------------------------------------- /tests/NIST-10MB.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES 3 | ------------------------------------------------------------------------------ 4 | generator is 5 | ------------------------------------------------------------------------------ 6 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST 7 | ------------------------------------------------------------------------------ 8 | 8 8 8 5 10 5 5 9 13 9 0.611108 78/80 Frequency 9 | 9 6 8 8 7 7 5 10 13 7 0.764655 80/80 BlockFrequency 10 | 8 5 12 5 10 6 5 8 12 9 0.484646 78/80 CumulativeSums 11 | 8 9 8 8 6 8 7 9 6 11 0.980883 78/80 CumulativeSums 12 | 5 9 4 4 11 12 9 9 7 10 0.414525 80/80 Runs 13 | 6 8 7 10 7 7 8 5 8 14 0.637119 80/80 LongestRun 14 | 16 13 5 7 1 4 6 11 9 8 0.008120 79/80 Rank 15 | 14 8 6 5 12 11 10 7 5 2 0.078086 79/80 FFT 16 | 5 7 6 9 7 6 10 8 10 12 0.788728 80/80 NonOverlappingTemplate 17 | 8 9 6 11 6 9 6 14 6 5 0.437274 78/80 NonOverlappingTemplate 18 | 9 10 10 7 4 9 11 7 7 6 0.811993 80/80 NonOverlappingTemplate 19 | 11 10 7 10 8 11 9 6 4 4 0.534146 78/80 NonOverlappingTemplate 20 | 13 10 8 5 4 4 9 8 8 11 0.350485 80/80 NonOverlappingTemplate 21 | 5 7 10 8 8 7 6 10 12 7 0.834308 80/80 NonOverlappingTemplate 22 | 12 4 10 11 6 8 5 8 8 8 0.611108 80/80 NonOverlappingTemplate 23 | 6 8 7 10 3 11 13 9 8 5 0.371101 79/80 NonOverlappingTemplate 24 | 7 7 12 10 5 10 9 8 9 3 0.559523 80/80 NonOverlappingTemplate 25 | 10 11 3 11 9 9 8 8 4 7 0.509162 77/80 NonOverlappingTemplate 26 | 9 6 10 14 8 7 8 6 6 6 0.611108 79/80 NonOverlappingTemplate 27 | 9 5 11 8 11 13 5 6 4 8 0.330628 79/80 NonOverlappingTemplate 28 | 9 6 6 10 4 10 8 15 5 7 0.242986 78/80 NonOverlappingTemplate 29 | 6 10 7 13 14 5 9 4 6 6 0.162606 78/80 NonOverlappingTemplate 30 | 10 12 4 9 7 6 6 9 6 11 0.585209 79/80 NonOverlappingTemplate 31 | 6 8 3 5 9 5 18 7 13 6 0.008120 80/80 NonOverlappingTemplate 32 | 13 9 6 5 12 9 7 9 8 2 0.227773 80/80 NonOverlappingTemplate 33 | 7 5 9 7 11 7 5 14 10 5 0.350485 79/80 NonOverlappingTemplate 34 | 11 7 6 7 6 7 9 16 4 7 0.174249 80/80 NonOverlappingTemplate 35 | 11 11 4 11 1 13 6 11 6 6 0.044942 79/80 NonOverlappingTemplate 36 | 7 8 12 9 9 4 7 8 7 9 0.855534 80/80 NonOverlappingTemplate 37 | 9 7 5 6 7 14 7 5 12 8 0.371101 80/80 NonOverlappingTemplate 38 | 5 11 8 8 10 10 7 9 9 3 0.663130 80/80 NonOverlappingTemplate 39 | 11 2 5 7 4 13 13 10 8 7 0.072289 79/80 NonOverlappingTemplate 40 | 10 9 6 5 7 12 7 8 6 10 0.788728 78/80 NonOverlappingTemplate 41 | 12 13 7 11 1 8 9 6 8 5 0.113706 78/80 NonOverlappingTemplate 42 | 9 5 15 7 8 5 6 6 7 12 0.227773 78/80 NonOverlappingTemplate 43 | 9 7 8 4 5 8 6 9 10 14 0.437274 80/80 NonOverlappingTemplate 44 | 5 11 9 4 9 10 3 10 12 7 0.293235 79/80 NonOverlappingTemplate 45 | 6 8 7 12 12 7 8 2 8 10 0.371101 79/80 NonOverlappingTemplate 46 | 2 6 10 7 10 5 16 7 10 7 0.066882 80/80 NonOverlappingTemplate 47 | 9 6 8 7 9 6 8 7 7 13 0.855534 78/80 NonOverlappingTemplate 48 | 7 6 11 8 9 7 7 5 9 11 0.875539 76/80 NonOverlappingTemplate 49 | 6 14 7 8 11 7 7 7 9 4 0.460664 80/80 NonOverlappingTemplate 50 | 8 7 11 7 5 7 6 8 12 9 0.811993 79/80 NonOverlappingTemplate 51 | 3 9 12 6 3 10 6 9 7 15 0.061841 80/80 NonOverlappingTemplate 52 | 10 7 9 6 3 11 15 8 7 4 0.131500 79/80 NonOverlappingTemplate 53 | 12 9 4 11 11 13 5 3 7 5 0.090936 79/80 NonOverlappingTemplate 54 | 11 6 4 9 9 8 7 11 6 9 0.764655 80/80 NonOverlappingTemplate 55 | 8 5 11 6 11 9 10 4 6 10 0.585209 79/80 NonOverlappingTemplate 56 | 9 4 10 6 6 10 5 4 11 15 0.105618 79/80 NonOverlappingTemplate 57 | 10 5 13 15 9 3 5 7 6 7 0.066882 80/80 NonOverlappingTemplate 58 | 6 4 8 9 10 11 4 9 11 8 0.585209 80/80 NonOverlappingTemplate 59 | 11 6 10 7 4 9 10 11 5 7 0.611108 78/80 NonOverlappingTemplate 60 | 8 5 9 13 8 8 7 5 8 9 0.764655 78/80 NonOverlappingTemplate 61 | 8 10 11 10 9 7 6 5 7 7 0.894201 80/80 NonOverlappingTemplate 62 | 9 9 12 11 4 9 7 6 6 7 0.663130 80/80 NonOverlappingTemplate 63 | 8 6 7 7 12 8 4 10 8 10 0.764655 79/80 NonOverlappingTemplate 64 | 5 4 13 6 11 11 10 10 8 2 0.105618 79/80 NonOverlappingTemplate 65 | 3 10 7 5 10 7 13 6 6 13 0.174249 79/80 NonOverlappingTemplate 66 | 6 12 6 5 9 7 9 9 12 5 0.559523 78/80 NonOverlappingTemplate 67 | 5 5 10 10 9 12 7 6 2 14 0.090936 79/80 NonOverlappingTemplate 68 | 10 7 6 8 10 11 7 6 9 6 0.911413 78/80 NonOverlappingTemplate 69 | 7 6 4 6 8 11 9 11 8 10 0.739918 77/80 NonOverlappingTemplate 70 | 9 10 11 11 8 7 9 5 8 2 0.460664 79/80 NonOverlappingTemplate 71 | 7 6 3 9 6 2 13 11 11 12 0.061841 79/80 NonOverlappingTemplate 72 | 5 12 10 11 12 3 7 6 8 6 0.275709 79/80 NonOverlappingTemplate 73 | 7 9 7 9 9 6 7 11 7 8 0.980883 79/80 NonOverlappingTemplate 74 | 12 6 7 8 8 6 12 7 6 8 0.764655 78/80 NonOverlappingTemplate 75 | 7 6 10 11 4 4 14 8 5 11 0.162606 80/80 NonOverlappingTemplate 76 | 7 9 11 8 7 9 10 9 8 2 0.663130 80/80 NonOverlappingTemplate 77 | 7 8 11 9 11 3 8 5 11 7 0.534146 78/80 NonOverlappingTemplate 78 | 7 8 11 9 2 10 9 6 5 13 0.258961 80/80 NonOverlappingTemplate 79 | 4 9 10 12 8 7 4 9 9 8 0.637119 80/80 NonOverlappingTemplate 80 | 10 5 6 9 8 9 10 8 5 10 0.875539 79/80 NonOverlappingTemplate 81 | 9 7 10 11 5 5 10 8 7 8 0.855534 78/80 NonOverlappingTemplate 82 | 7 6 9 9 3 11 10 6 10 9 0.663130 78/80 NonOverlappingTemplate 83 | 8 11 6 9 7 11 6 6 10 6 0.834308 79/80 NonOverlappingTemplate 84 | 11 14 7 2 7 9 10 8 5 7 0.199580 79/80 NonOverlappingTemplate 85 | 7 7 5 13 9 10 6 4 12 7 0.371101 80/80 NonOverlappingTemplate 86 | 11 11 3 12 7 11 6 4 6 9 0.227773 78/80 NonOverlappingTemplate 87 | 8 9 9 8 4 10 9 3 9 11 0.611108 79/80 NonOverlappingTemplate 88 | 3 8 8 4 11 7 7 11 9 12 0.371101 80/80 NonOverlappingTemplate 89 | 14 3 10 5 7 12 12 4 5 8 0.057146 78/80 NonOverlappingTemplate 90 | 5 7 6 9 7 5 11 8 10 12 0.663130 80/80 NonOverlappingTemplate 91 | 9 6 10 10 10 10 6 4 5 10 0.663130 79/80 NonOverlappingTemplate 92 | 8 9 5 9 10 11 7 6 9 6 0.894201 80/80 NonOverlappingTemplate 93 | 9 13 8 12 7 6 7 3 8 7 0.414525 79/80 NonOverlappingTemplate 94 | 9 15 5 3 9 10 8 5 7 9 0.186566 79/80 NonOverlappingTemplate 95 | 8 6 8 11 4 5 8 11 10 9 0.689019 79/80 NonOverlappingTemplate 96 | 5 10 5 5 7 4 15 9 10 10 0.151616 80/80 NonOverlappingTemplate 97 | 8 4 8 10 7 13 10 6 7 7 0.637119 80/80 NonOverlappingTemplate 98 | 12 8 13 6 9 3 8 11 5 5 0.199580 79/80 NonOverlappingTemplate 99 | 13 4 7 9 7 10 8 8 5 9 0.611108 79/80 NonOverlappingTemplate 100 | 15 7 11 9 8 5 6 3 9 7 0.186566 80/80 NonOverlappingTemplate 101 | 6 7 13 7 5 13 7 4 7 11 0.242986 80/80 NonOverlappingTemplate 102 | 11 8 5 10 4 12 7 6 12 5 0.311542 79/80 NonOverlappingTemplate 103 | 9 5 12 9 5 10 6 8 9 7 0.764655 80/80 NonOverlappingTemplate 104 | 7 11 5 8 5 3 8 9 13 11 0.275709 79/80 NonOverlappingTemplate 105 | 7 9 7 11 11 10 7 6 5 7 0.834308 80/80 NonOverlappingTemplate 106 | 9 5 15 8 5 12 5 3 11 7 0.066882 78/80 NonOverlappingTemplate 107 | 11 5 13 12 5 5 8 6 9 6 0.293235 79/80 NonOverlappingTemplate 108 | 11 10 7 10 8 11 7 5 4 7 0.663130 79/80 NonOverlappingTemplate 109 | 5 6 3 9 11 9 10 10 8 9 0.611108 78/80 NonOverlappingTemplate 110 | 6 11 12 3 4 4 13 14 8 5 0.021262 80/80 NonOverlappingTemplate 111 | 9 8 10 11 9 2 5 11 8 7 0.460664 79/80 NonOverlappingTemplate 112 | 8 8 11 3 11 5 5 7 9 13 0.275709 78/80 NonOverlappingTemplate 113 | 8 9 9 8 7 13 8 2 7 9 0.509162 79/80 NonOverlappingTemplate 114 | 10 10 7 13 9 11 5 4 8 3 0.227773 80/80 NonOverlappingTemplate 115 | 10 5 7 7 8 12 10 8 8 5 0.788728 80/80 NonOverlappingTemplate 116 | 7 9 6 11 10 4 9 12 8 4 0.484646 80/80 NonOverlappingTemplate 117 | 7 9 10 6 5 5 9 9 9 11 0.834308 80/80 NonOverlappingTemplate 118 | 6 2 10 7 10 10 10 8 4 13 0.199580 80/80 NonOverlappingTemplate 119 | 9 7 6 6 13 6 5 12 7 9 0.509162 79/80 NonOverlappingTemplate 120 | 7 14 8 8 8 5 10 11 1 8 0.141256 79/80 NonOverlappingTemplate 121 | 12 7 8 5 10 7 7 6 7 11 0.764655 80/80 NonOverlappingTemplate 122 | 11 10 6 7 8 6 10 9 5 8 0.875539 79/80 NonOverlappingTemplate 123 | 6 7 11 11 7 7 8 3 10 10 0.611108 80/80 NonOverlappingTemplate 124 | 5 11 6 12 10 11 3 7 9 6 0.330628 78/80 NonOverlappingTemplate 125 | 11 9 8 6 4 7 10 9 7 9 0.855534 80/80 NonOverlappingTemplate 126 | 9 5 6 9 8 4 3 11 8 17 0.032381 80/80 NonOverlappingTemplate 127 | 6 12 8 9 5 8 9 7 5 11 0.714660 78/80 NonOverlappingTemplate 128 | 10 7 10 4 7 7 6 7 11 11 0.714660 78/80 NonOverlappingTemplate 129 | 8 11 11 6 6 8 6 8 10 6 0.855534 80/80 NonOverlappingTemplate 130 | 11 7 7 10 6 8 7 8 7 9 0.973388 78/80 NonOverlappingTemplate 131 | 8 9 7 8 10 11 7 7 6 7 0.973388 80/80 NonOverlappingTemplate 132 | 10 9 6 5 3 8 5 13 11 10 0.258961 80/80 NonOverlappingTemplate 133 | 10 9 10 3 5 11 6 10 7 9 0.559523 79/80 NonOverlappingTemplate 134 | 5 18 6 7 6 9 7 9 5 8 0.061841 80/80 NonOverlappingTemplate 135 | 11 8 7 8 10 10 7 7 6 6 0.941144 78/80 NonOverlappingTemplate 136 | 6 11 6 17 7 5 5 9 7 7 0.090936 80/80 NonOverlappingTemplate 137 | 9 7 11 5 7 15 5 8 10 3 0.141256 79/80 NonOverlappingTemplate 138 | 11 7 12 1 8 10 8 6 8 9 0.311542 80/80 NonOverlappingTemplate 139 | 9 9 5 8 10 7 11 3 10 8 0.663130 80/80 NonOverlappingTemplate 140 | 5 10 9 4 8 12 7 7 10 8 0.689019 79/80 NonOverlappingTemplate 141 | 7 7 7 10 7 15 5 7 13 2 0.066882 79/80 NonOverlappingTemplate 142 | 4 9 10 13 9 7 10 10 5 3 0.258961 79/80 NonOverlappingTemplate 143 | 4 13 8 9 12 3 10 8 6 7 0.242986 79/80 NonOverlappingTemplate 144 | 4 7 13 10 8 7 7 12 5 7 0.414525 79/80 NonOverlappingTemplate 145 | 8 3 13 6 9 11 10 8 7 5 0.371101 78/80 NonOverlappingTemplate 146 | 9 12 9 6 6 8 8 7 3 12 0.484646 80/80 NonOverlappingTemplate 147 | 9 5 9 12 7 6 8 9 9 6 0.855534 79/80 NonOverlappingTemplate 148 | 8 10 6 8 11 4 10 7 7 9 0.834308 79/80 NonOverlappingTemplate 149 | 10 10 7 8 3 12 8 8 7 7 0.689019 79/80 NonOverlappingTemplate 150 | 4 6 5 8 4 11 7 15 7 13 0.061841 79/80 NonOverlappingTemplate 151 | 6 4 15 10 9 9 12 5 3 7 0.072289 78/80 NonOverlappingTemplate 152 | 10 6 9 6 6 12 4 11 2 14 0.061841 80/80 NonOverlappingTemplate 153 | 8 6 9 8 8 9 9 12 5 6 0.875539 80/80 NonOverlappingTemplate 154 | 5 8 12 9 10 3 9 10 8 6 0.534146 79/80 NonOverlappingTemplate 155 | 8 9 7 4 8 7 10 11 9 7 0.894201 80/80 NonOverlappingTemplate 156 | 7 15 7 6 3 7 9 11 10 5 0.162606 80/80 NonOverlappingTemplate 157 | 6 7 4 5 6 8 17 6 8 13 0.035174 79/80 NonOverlappingTemplate 158 | 7 4 12 6 4 6 10 13 11 7 0.213309 80/80 NonOverlappingTemplate 159 | 8 8 6 8 6 12 9 6 6 11 0.811993 79/80 NonOverlappingTemplate 160 | 7 10 10 8 7 12 7 4 10 5 0.637119 79/80 NonOverlappingTemplate 161 | 7 9 12 6 5 10 8 9 5 9 0.764655 80/80 NonOverlappingTemplate 162 | 12 8 5 7 5 10 12 5 6 10 0.437274 80/80 NonOverlappingTemplate 163 | 14 3 9 6 7 12 12 4 5 8 0.078086 78/80 NonOverlappingTemplate 164 | 6 7 12 10 10 10 7 4 5 9 0.585209 80/80 OverlappingTemplate 165 | 9 6 4 11 6 9 9 7 8 11 0.764655 78/80 Universal 166 | 10 7 10 3 11 4 12 10 9 4 0.213309 80/80 ApproximateEntropy 167 | 7 3 6 2 7 6 6 4 4 8 0.637119 53/53 RandomExcursions 168 | 3 7 5 4 9 10 4 5 3 3 0.224821 53/53 RandomExcursions 169 | 5 5 5 9 6 5 10 0 4 4 0.129620 53/53 RandomExcursions 170 | 4 4 1 10 4 6 3 8 9 4 0.090936 52/53 RandomExcursions 171 | 5 4 5 8 7 4 2 3 5 10 0.304126 51/53 RandomExcursions 172 | 10 6 7 2 3 5 8 4 6 2 0.181557 52/53 RandomExcursions 173 | 6 6 2 8 6 8 6 3 5 3 0.554420 51/53 RandomExcursions 174 | 6 7 5 6 5 6 4 6 3 5 0.978072 52/53 RandomExcursions 175 | 7 8 9 2 7 1 4 6 7 2 0.102526 52/53 RandomExcursionsVariant 176 | 9 3 12 6 4 3 3 4 2 7 0.028817 53/53 RandomExcursionsVariant 177 | 10 4 5 7 9 4 6 2 3 3 0.162606 52/53 RandomExcursionsVariant 178 | 9 7 2 4 3 10 6 4 4 4 0.181557 52/53 RandomExcursionsVariant 179 | 8 7 3 1 6 6 5 6 7 4 0.514124 52/53 RandomExcursionsVariant 180 | 7 6 7 3 3 5 6 7 4 5 0.867692 52/53 RandomExcursionsVariant 181 | 5 12 3 6 3 2 8 5 3 6 0.062821 53/53 RandomExcursionsVariant 182 | 7 9 4 3 3 6 6 5 5 5 0.719747 52/53 RandomExcursionsVariant 183 | 5 7 2 7 1 11 3 6 5 6 0.090936 52/53 RandomExcursionsVariant 184 | 4 6 5 2 9 4 5 10 2 6 0.181557 52/53 RandomExcursionsVariant 185 | 5 5 3 4 8 7 5 8 2 6 0.595549 52/53 RandomExcursionsVariant 186 | 3 7 5 4 5 6 3 4 11 5 0.334538 52/53 RandomExcursionsVariant 187 | 3 7 3 6 6 7 6 7 2 6 0.678686 53/53 RandomExcursionsVariant 188 | 4 6 6 2 9 5 4 3 8 6 0.474986 53/53 RandomExcursionsVariant 189 | 3 7 9 6 6 1 4 6 4 7 0.366918 52/53 RandomExcursionsVariant 190 | 4 4 11 9 3 4 5 2 4 7 0.102526 52/53 RandomExcursionsVariant 191 | 3 5 8 10 5 5 2 4 7 4 0.304126 52/53 RandomExcursionsVariant 192 | 4 7 7 4 3 5 9 5 7 2 0.474986 52/53 RandomExcursionsVariant 193 | 7 8 7 9 5 8 3 9 12 12 0.460664 80/80 Serial 194 | 4 9 10 4 8 8 6 6 15 10 0.199580 80/80 Serial 195 | 13 9 6 11 6 3 10 6 9 7 0.371101 80/80 LinearComplexity 196 | 197 | 198 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 199 | The minimum pass rate for each statistical test with the exception of the 200 | random excursion (variant) test is approximately = 76 for a 201 | sample size = 80 binary sequences. 202 | 203 | The minimum pass rate for the random excursion (variant) test 204 | is approximately = 50 for a sample size = 53 binary sequences. 205 | 206 | For further guidelines construct a probability table using the MAPLE program 207 | provided in the addendum section of the documentation. 208 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209 | -------------------------------------------------------------------------------- /tests/NIST-100MB.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES 3 | ------------------------------------------------------------------------------ 4 | generator is 5 | ------------------------------------------------------------------------------ 6 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST 7 | ------------------------------------------------------------------------------ 8 | 92 77 75 97 75 67 91 81 71 74 0.258961 790/800 Frequency 9 | 78 81 81 77 101 78 79 69 67 89 0.319084 792/800 BlockFrequency 10 | 87 85 76 71 78 78 87 78 70 90 0.798139 791/800 CumulativeSums 11 | 94 82 63 91 96 91 72 72 65 74 0.045675 788/800 CumulativeSums 12 | 85 85 84 78 68 80 71 75 90 84 0.793450 792/800 Runs 13 | 69 87 77 85 80 65 87 76 79 95 0.437274 794/800 LongestRun 14 | 69 85 81 95 60 72 82 86 81 89 0.214722 795/800 Rank 15 | 80 83 80 84 90 73 88 78 85 59 0.451234 790/800 FFT 16 | 87 88 92 57 80 91 76 73 76 80 0.194289 790/800 NonOverlappingTemplate 17 | 75 93 79 67 83 86 84 90 69 74 0.482223 795/800 NonOverlappingTemplate 18 | 79 71 80 82 68 87 86 89 78 80 0.834308 793/800 NonOverlappingTemplate 19 | 83 90 75 87 92 72 68 67 90 76 0.330628 793/800 NonOverlappingTemplate 20 | 77 83 87 84 73 66 75 73 75 107 0.107194 797/800 NonOverlappingTemplate 21 | 72 87 93 79 63 87 77 70 86 86 0.348465 792/800 NonOverlappingTemplate 22 | 78 82 91 84 72 71 89 72 82 79 0.788728 788/800 NonOverlappingTemplate 23 | 84 79 77 79 78 74 111 75 74 69 0.087559 791/800 NonOverlappingTemplate 24 | 81 77 100 84 65 81 70 75 94 73 0.173054 793/800 NonOverlappingTemplate 25 | 105 71 91 74 63 73 71 91 73 88 0.025621 790/800 NonOverlappingTemplate 26 | 75 87 86 86 80 71 71 75 96 73 0.536668 787/800 NonOverlappingTemplate 27 | 87 80 84 85 78 84 82 64 70 86 0.707002 794/800 NonOverlappingTemplate 28 | 88 64 94 83 82 76 75 77 80 81 0.611108 792/800 NonOverlappingTemplate 29 | 92 82 90 77 71 73 75 77 91 72 0.577476 788/800 NonOverlappingTemplate 30 | 89 79 73 76 83 76 90 78 81 75 0.925588 793/800 NonOverlappingTemplate 31 | 89 77 88 76 81 71 90 80 72 76 0.798139 794/800 NonOverlappingTemplate 32 | 68 70 90 81 81 96 84 79 82 69 0.410055 793/800 NonOverlappingTemplate 33 | 86 83 76 102 88 86 71 74 65 69 0.127762 790/800 NonOverlappingTemplate 34 | 71 72 80 77 81 85 77 83 96 78 0.767095 794/800 NonOverlappingTemplate 35 | 80 84 79 80 81 85 94 70 74 73 0.807412 791/800 NonOverlappingTemplate 36 | 82 81 72 83 75 69 83 80 88 87 0.888750 791/800 NonOverlappingTemplate 37 | 89 78 68 82 85 65 83 100 79 71 0.203623 796/800 NonOverlappingTemplate 38 | 81 86 73 74 84 87 86 71 80 78 0.921005 789/800 NonOverlappingTemplate 39 | 84 92 66 88 77 75 88 79 73 78 0.621506 790/800 NonOverlappingTemplate 40 | 72 71 79 82 80 88 100 75 69 84 0.375313 791/800 NonOverlappingTemplate 41 | 76 71 76 85 73 74 84 100 76 85 0.484646 788/800 NonOverlappingTemplate 42 | 85 94 67 83 73 69 77 84 87 81 0.529115 793/800 NonOverlappingTemplate 43 | 77 78 75 69 86 82 86 93 81 73 0.771953 796/800 NonOverlappingTemplate 44 | 83 81 72 80 77 83 83 83 61 97 0.392456 792/800 NonOverlappingTemplate 45 | 75 104 71 77 93 86 55 77 85 77 0.020902 791/800 NonOverlappingTemplate 46 | 72 85 78 80 78 67 88 84 73 95 0.559523 796/800 NonOverlappingTemplate 47 | 81 73 76 91 82 86 86 75 60 90 0.362765 793/800 NonOverlappingTemplate 48 | 84 88 79 75 80 87 67 87 76 77 0.836482 788/800 NonOverlappingTemplate 49 | 85 73 87 88 75 76 78 80 71 87 0.873597 792/800 NonOverlappingTemplate 50 | 80 80 86 75 79 81 88 71 82 78 0.975012 795/800 NonOverlappingTemplate 51 | 65 81 81 81 56 78 84 98 86 90 0.065845 793/800 NonOverlappingTemplate 52 | 68 91 72 84 73 81 96 83 86 66 0.265567 791/800 NonOverlappingTemplate 53 | 86 73 70 72 90 64 78 95 97 75 0.110408 794/800 NonOverlappingTemplate 54 | 79 71 84 66 86 77 81 93 75 88 0.587791 786/800 NonOverlappingTemplate 55 | 71 91 85 80 70 67 79 81 93 83 0.489508 791/800 NonOverlappingTemplate 56 | 82 76 85 88 86 74 82 71 85 71 0.863690 794/800 NonOverlappingTemplate 57 | 73 91 62 79 77 80 80 78 99 81 0.284375 792/800 NonOverlappingTemplate 58 | 94 92 77 90 86 82 68 77 68 66 0.198246 787/800 NonOverlappingTemplate 59 | 78 69 80 87 72 89 93 75 82 75 0.660532 789/800 NonOverlappingTemplate 60 | 74 86 81 74 75 89 75 79 76 91 0.857592 789/800 NonOverlappingTemplate 61 | 81 79 72 104 64 74 87 64 86 89 0.049505 791/800 NonOverlappingTemplate 62 | 77 71 66 74 78 99 80 71 95 89 0.144299 794/800 NonOverlappingTemplate 63 | 84 85 82 79 79 84 69 79 87 72 0.928563 792/800 NonOverlappingTemplate 64 | 85 75 75 90 83 70 82 82 88 70 0.769527 794/800 NonOverlappingTemplate 65 | 77 79 87 78 75 79 80 84 82 79 0.997972 787/800 NonOverlappingTemplate 66 | 85 89 67 73 87 79 104 77 67 72 0.093720 793/800 NonOverlappingTemplate 67 | 78 85 103 61 75 83 90 72 87 66 0.048326 795/800 NonOverlappingTemplate 68 | 76 89 67 88 78 75 82 75 92 78 0.668321 794/800 NonOverlappingTemplate 69 | 69 79 85 100 66 70 80 94 73 84 0.129620 791/800 NonOverlappingTemplate 70 | 87 93 84 77 76 66 86 86 77 68 0.484646 794/800 NonOverlappingTemplate 71 | 90 76 83 87 80 90 86 64 67 77 0.410055 788/800 NonOverlappingTemplate 72 | 88 77 93 73 85 75 87 65 71 86 0.423545 789/800 NonOverlappingTemplate 73 | 78 66 76 68 69 86 91 92 96 78 0.161478 795/800 NonOverlappingTemplate 74 | 74 77 75 79 67 84 91 81 82 90 0.737414 792/800 NonOverlappingTemplate 75 | 84 79 84 68 75 78 73 91 84 84 0.825505 794/800 NonOverlappingTemplate 76 | 86 84 73 93 73 73 90 72 78 78 0.663130 791/800 NonOverlappingTemplate 77 | 89 70 71 76 76 91 92 73 82 80 0.569766 793/800 NonOverlappingTemplate 78 | 89 74 68 73 72 69 94 95 76 90 0.167184 791/800 NonOverlappingTemplate 79 | 76 90 83 70 60 83 82 85 90 81 0.388127 792/800 NonOverlappingTemplate 80 | 79 66 75 95 77 71 95 98 69 75 0.080519 795/800 NonOverlappingTemplate 81 | 86 80 98 77 68 83 96 72 74 66 0.144299 792/800 NonOverlappingTemplate 82 | 88 73 80 83 66 72 81 60 99 98 0.031323 788/800 NonOverlappingTemplate 83 | 75 79 84 80 69 71 86 89 89 78 0.781584 790/800 NonOverlappingTemplate 84 | 77 73 72 92 66 75 86 90 82 87 0.489508 790/800 NonOverlappingTemplate 85 | 86 85 79 76 89 77 67 82 80 79 0.892399 792/800 NonOverlappingTemplate 86 | 87 78 82 74 89 89 68 86 69 78 0.637119 793/800 NonOverlappingTemplate 87 | 73 79 61 70 87 94 82 76 79 99 0.114544 792/800 NonOverlappingTemplate 88 | 79 80 77 75 78 83 64 81 91 92 0.624107 793/800 NonOverlappingTemplate 89 | 81 86 89 72 73 87 75 87 74 76 0.827722 793/800 NonOverlappingTemplate 90 | 87 88 92 57 80 91 76 73 76 80 0.194289 790/800 NonOverlappingTemplate 91 | 71 80 89 81 75 80 95 83 76 70 0.665726 795/800 NonOverlappingTemplate 92 | 76 70 70 95 81 74 95 76 74 89 0.315297 790/800 NonOverlappingTemplate 93 | 87 68 98 80 90 77 67 69 75 89 0.173054 794/800 NonOverlappingTemplate 94 | 83 73 90 74 87 78 80 76 90 69 0.734904 784/800 NonOverlappingTemplate 95 | 78 60 93 78 82 84 69 84 75 97 0.158133 791/800 NonOverlappingTemplate 96 | 71 84 80 65 76 66 93 86 100 79 0.113706 792/800 NonOverlappingTemplate 97 | 90 80 87 97 82 73 71 94 63 63 0.051528 785/800 NonOverlappingTemplate 98 | 88 81 76 89 70 92 85 67 76 76 0.544254 786/800 NonOverlappingTemplate 99 | 86 76 74 63 91 68 90 82 82 88 0.336505 790/800 NonOverlappingTemplate 100 | 68 88 77 87 92 63 83 79 72 91 0.263904 791/800 NonOverlappingTemplate 101 | 90 72 79 69 74 91 88 89 81 67 0.394631 787/800 NonOverlappingTemplate 102 | 64 82 88 66 91 90 77 83 82 77 0.379555 795/800 NonOverlappingTemplate 103 | 84 80 70 97 72 78 63 73 92 91 0.143279 795/800 NonOverlappingTemplate 104 | 86 97 88 81 64 73 79 83 79 70 0.344448 791/800 NonOverlappingTemplate 105 | 81 77 77 93 57 95 77 79 87 77 0.180322 788/800 NonOverlappingTemplate 106 | 81 80 76 78 75 79 71 81 85 94 0.885045 795/800 NonOverlappingTemplate 107 | 84 83 73 92 67 66 94 76 77 88 0.286131 793/800 NonOverlappingTemplate 108 | 85 76 74 91 89 73 83 88 72 69 0.603322 793/800 NonOverlappingTemplate 109 | 82 85 93 86 67 80 93 69 73 72 0.344448 794/800 NonOverlappingTemplate 110 | 88 88 71 80 91 60 75 79 81 87 0.344448 789/800 NonOverlappingTemplate 111 | 72 85 92 77 90 78 74 80 66 86 0.567201 790/800 NonOverlappingTemplate 112 | 64 83 86 83 84 92 78 68 88 74 0.439585 794/800 NonOverlappingTemplate 113 | 85 77 75 94 73 76 84 82 85 69 0.732389 793/800 NonOverlappingTemplate 114 | 83 88 73 72 70 86 87 80 92 69 0.539193 793/800 NonOverlappingTemplate 115 | 83 67 70 86 76 79 87 84 79 89 0.742418 791/800 NonOverlappingTemplate 116 | 86 90 75 95 87 78 75 56 73 85 0.125018 792/800 NonOverlappingTemplate 117 | 66 85 78 71 81 83 64 93 90 89 0.241430 795/800 NonOverlappingTemplate 118 | 87 73 73 86 76 80 81 86 77 81 0.961247 790/800 NonOverlappingTemplate 119 | 71 73 82 89 81 78 79 88 71 88 0.800471 792/800 NonOverlappingTemplate 120 | 92 94 79 83 89 82 76 72 65 68 0.272297 793/800 NonOverlappingTemplate 121 | 68 106 100 80 73 74 86 68 66 79 0.012540 795/800 NonOverlappingTemplate 122 | 77 75 89 81 77 68 97 80 82 74 0.587791 787/800 NonOverlappingTemplate 123 | 88 87 61 99 79 95 68 74 71 78 0.055803 793/800 NonOverlappingTemplate 124 | 102 84 63 75 83 73 75 84 84 77 0.229260 795/800 NonOverlappingTemplate 125 | 76 73 67 73 105 68 86 81 84 87 0.107990 795/800 NonOverlappingTemplate 126 | 78 88 74 77 78 65 94 89 80 77 0.549331 793/800 NonOverlappingTemplate 127 | 81 88 78 99 83 88 68 59 76 80 0.129620 795/800 NonOverlappingTemplate 128 | 72 73 98 87 84 85 73 81 81 66 0.377431 790/800 NonOverlappingTemplate 129 | 81 77 105 66 77 87 89 68 72 78 0.097305 787/800 NonOverlappingTemplate 130 | 55 71 78 90 92 90 74 70 99 81 0.021999 793/800 NonOverlappingTemplate 131 | 84 81 79 84 58 89 82 86 77 80 0.524101 786/800 NonOverlappingTemplate 132 | 88 80 92 69 80 79 78 79 70 85 0.764655 791/800 NonOverlappingTemplate 133 | 93 71 72 86 72 80 85 70 95 76 0.371101 789/800 NonOverlappingTemplate 134 | 93 89 68 66 72 82 69 87 85 89 0.232257 794/800 NonOverlappingTemplate 135 | 80 66 74 75 79 96 84 77 101 68 0.120558 793/800 NonOverlappingTemplate 136 | 80 67 73 76 69 88 74 95 78 100 0.139257 789/800 NonOverlappingTemplate 137 | 72 94 101 86 74 73 76 76 66 82 0.154846 788/800 NonOverlappingTemplate 138 | 88 85 86 76 66 80 83 80 75 81 0.863690 793/800 NonOverlappingTemplate 139 | 80 81 79 81 83 79 85 71 89 72 0.951205 795/800 NonOverlappingTemplate 140 | 76 88 83 71 88 81 74 88 81 70 0.793450 790/800 NonOverlappingTemplate 141 | 80 84 84 75 77 71 91 81 75 82 0.928563 790/800 NonOverlappingTemplate 142 | 88 72 82 83 84 87 75 82 77 70 0.890582 796/800 NonOverlappingTemplate 143 | 87 85 78 80 90 78 78 86 67 71 0.749884 795/800 NonOverlappingTemplate 144 | 91 64 62 78 83 94 79 79 87 83 0.206354 792/800 NonOverlappingTemplate 145 | 61 81 71 77 83 84 84 92 85 82 0.501755 795/800 NonOverlappingTemplate 146 | 81 78 88 84 83 75 78 90 81 62 0.652733 795/800 NonOverlappingTemplate 147 | 88 62 84 93 60 86 76 76 82 93 0.086240 790/800 NonOverlappingTemplate 148 | 81 87 77 70 100 63 81 79 77 85 0.272297 790/800 NonOverlappingTemplate 149 | 83 79 84 64 68 74 88 83 87 90 0.479805 789/800 NonOverlappingTemplate 150 | 88 93 64 64 91 97 69 73 77 84 0.050710 790/800 NonOverlappingTemplate 151 | 80 80 80 73 69 88 77 94 75 84 0.739918 792/800 NonOverlappingTemplate 152 | 97 77 69 90 74 87 78 58 89 81 0.100259 793/800 NonOverlappingTemplate 153 | 80 93 72 86 76 86 77 69 84 77 0.744912 789/800 NonOverlappingTemplate 154 | 84 78 83 74 75 82 76 78 70 100 0.567201 792/800 NonOverlappingTemplate 155 | 79 90 66 87 75 86 77 83 75 82 0.771953 793/800 NonOverlappingTemplate 156 | 84 73 88 75 76 79 82 78 83 82 0.983453 792/800 NonOverlappingTemplate 157 | 73 73 98 71 98 72 70 78 80 87 0.160357 796/800 NonOverlappingTemplate 158 | 93 97 68 83 79 78 54 85 75 88 0.040437 791/800 NonOverlappingTemplate 159 | 82 82 91 85 78 88 71 74 69 80 0.764655 792/800 NonOverlappingTemplate 160 | 73 95 82 73 81 77 81 64 90 84 0.448892 788/800 NonOverlappingTemplate 161 | 72 92 74 72 67 79 99 76 81 88 0.242986 791/800 NonOverlappingTemplate 162 | 81 80 79 69 91 74 87 88 79 72 0.767095 793/800 NonOverlappingTemplate 163 | 81 86 89 71 75 86 75 88 73 76 0.818794 793/800 NonOverlappingTemplate 164 | 87 95 72 76 75 88 76 80 75 76 0.714660 785/800 OverlappingTemplate 165 | 98 77 85 70 83 75 68 77 80 87 0.467799 789/800 Universal 166 | 74 82 93 85 81 70 83 84 80 68 0.709558 792/800 ApproximateEntropy 167 | 44 48 53 43 44 56 49 52 58 41 0.689019 486/488 RandomExcursions 168 | 48 41 51 44 52 52 49 42 46 63 0.559523 486/488 RandomExcursions 169 | 38 44 41 52 54 52 45 55 53 54 0.602458 485/488 RandomExcursions 170 | 43 52 38 43 52 45 55 56 50 54 0.619772 481/488 RandomExcursions 171 | 55 64 46 43 44 49 45 51 48 43 0.513295 483/488 RandomExcursions 172 | 62 39 45 50 43 54 53 44 46 52 0.476590 482/488 RandomExcursions 173 | 50 49 40 54 51 51 53 48 39 53 0.808178 485/488 RandomExcursions 174 | 53 50 46 48 49 55 60 33 50 44 0.364146 481/488 RandomExcursions 175 | 46 40 38 60 61 52 51 65 38 37 0.011931 484/488 RandomExcursionsVariant 176 | 43 40 44 68 55 58 41 51 41 47 0.069538 484/488 RandomExcursionsVariant 177 | 43 45 61 50 59 46 43 38 54 49 0.327393 483/488 RandomExcursionsVariant 178 | 43 50 54 52 42 51 49 36 52 59 0.484646 483/488 RandomExcursionsVariant 179 | 48 54 52 45 50 42 42 38 68 49 0.149847 486/488 RandomExcursionsVariant 180 | 44 60 46 35 42 65 48 55 51 42 0.074177 485/488 RandomExcursionsVariant 181 | 47 45 47 50 50 51 51 49 55 43 0.985035 483/488 RandomExcursionsVariant 182 | 47 49 52 46 52 42 56 48 38 58 0.632781 483/488 RandomExcursionsVariant 183 | 51 37 57 46 52 55 51 29 55 55 0.076109 484/488 RandomExcursionsVariant 184 | 42 51 46 47 48 56 46 56 40 56 0.693313 483/488 RandomExcursionsVariant 185 | 40 53 51 44 59 50 65 45 36 45 0.109597 483/488 RandomExcursionsVariant 186 | 37 49 53 60 60 54 46 40 47 42 0.213309 482/488 RandomExcursionsVariant 187 | 48 47 60 51 35 50 53 51 54 39 0.353869 483/488 RandomExcursionsVariant 188 | 54 45 41 57 44 49 57 39 55 47 0.492762 484/488 RandomExcursionsVariant 189 | 53 41 47 49 50 60 46 47 38 57 0.480610 485/488 RandomExcursionsVariant 190 | 55 39 50 50 52 48 60 47 44 43 0.628443 481/488 RandomExcursionsVariant 191 | 56 42 47 53 47 56 48 53 40 46 0.748229 479/488 RandomExcursionsVariant 192 | 52 45 56 37 43 49 61 47 52 46 0.448892 480/488 RandomExcursionsVariant 193 | 81 70 81 88 76 80 76 82 71 95 0.704442 794/800 Serial 194 | 80 69 86 84 78 71 69 82 93 88 0.564639 785/800 Serial 195 | 70 77 85 91 81 77 90 81 69 79 0.729870 798/800 LinearComplexity 196 | 197 | 198 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 199 | The minimum pass rate for each statistical test with the exception of the 200 | random excursion (variant) test is approximately = 783 for a 201 | sample size = 800 binary sequences. 202 | 203 | The minimum pass rate for the random excursion (variant) test 204 | is approximately = 476 for a sample size = 488 binary sequences. 205 | 206 | For further guidelines construct a probability table using the MAPLE program 207 | provided in the addendum section of the documentation. 208 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209 | -------------------------------------------------------------------------------- /tests/NIST-1GB.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES 3 | ------------------------------------------------------------------------------ 4 | generator is 5 | ------------------------------------------------------------------------------ 6 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST 7 | ------------------------------------------------------------------------------ 8 | 759 800 795 806 759 855 860 806 774 786 0.133596 7926/8000 Frequency 9 | 871 770 762 772 823 816 821 795 767 803 0.156045 7901/8000 BlockFrequency 10 | 767 769 744 802 839 839 830 822 775 813 0.162041 7930/8000 CumulativeSums 11 | 746 798 798 797 813 770 824 805 825 824 0.610589 7932/8000 CumulativeSums 12 | 831 798 745 830 825 819 773 737 806 836 0.094214 7915/8000 Runs 13 | 816 793 822 805 836 791 760 799 768 810 0.725323 7909/8000 LongestRun 14 | 831 734 832 848 797 812 774 759 810 803 0.119508 7921/8000 Rank 15 | 850 824 864 815 774 753 818 802 788 712 0.005927 7904/8000 FFT 16 | 799 800 788 799 816 836 820 784 816 742 0.588566 7923/8000 NonOverlappingTemplate 17 | 814 812 801 746 791 831 800 847 770 788 0.397688 7922/8000 NonOverlappingTemplate 18 | 788 783 752 776 781 873 799 825 820 803 0.184173 7925/8000 NonOverlappingTemplate 19 | 777 814 836 826 770 794 771 812 788 812 0.726587 7926/8000 NonOverlappingTemplate 20 | 790 802 787 782 806 834 792 814 811 782 0.959454 7905/8000 NonOverlappingTemplate 21 | 754 799 843 814 797 751 862 845 799 736 0.014187 7918/8000 NonOverlappingTemplate 22 | 806 783 782 786 840 780 826 809 802 786 0.855328 7925/8000 NonOverlappingTemplate 23 | 775 791 810 848 808 774 782 807 757 848 0.313792 7938/8000 NonOverlappingTemplate 24 | 789 806 799 802 837 757 802 829 794 785 0.778467 7921/8000 NonOverlappingTemplate 25 | 787 762 809 787 798 812 794 840 775 836 0.641284 7917/8000 NonOverlappingTemplate 26 | 757 804 797 794 810 830 827 805 787 789 0.839292 7925/8000 NonOverlappingTemplate 27 | 783 754 815 834 829 815 774 809 793 794 0.624887 7925/8000 NonOverlappingTemplate 28 | 752 801 795 819 774 805 836 825 768 825 0.465177 7930/8000 NonOverlappingTemplate 29 | 822 798 804 773 848 778 770 819 769 819 0.508667 7909/8000 NonOverlappingTemplate 30 | 848 821 793 759 778 839 755 787 835 785 0.178849 7920/8000 NonOverlappingTemplate 31 | 769 784 848 839 774 801 785 813 803 784 0.536920 7926/8000 NonOverlappingTemplate 32 | 810 816 822 823 774 788 793 799 797 778 0.945550 7936/8000 NonOverlappingTemplate 33 | 784 838 844 790 823 771 791 770 834 755 0.237728 7929/8000 NonOverlappingTemplate 34 | 768 834 856 712 783 791 851 796 796 813 0.016205 7923/8000 NonOverlappingTemplate 35 | 815 776 810 772 811 842 780 808 806 780 0.780387 7924/8000 NonOverlappingTemplate 36 | 760 841 806 787 766 825 785 794 819 817 0.562335 7925/8000 NonOverlappingTemplate 37 | 812 783 804 790 811 776 813 782 845 784 0.832124 7920/8000 NonOverlappingTemplate 38 | 865 786 795 773 819 810 817 775 782 778 0.419247 7919/8000 NonOverlappingTemplate 39 | 745 743 825 782 785 818 845 798 818 841 0.097816 7926/8000 NonOverlappingTemplate 40 | 766 769 824 803 858 824 816 798 778 764 0.285955 7926/8000 NonOverlappingTemplate 41 | 815 774 787 758 792 798 788 806 857 825 0.465891 7921/8000 NonOverlappingTemplate 42 | 767 784 799 779 789 811 844 768 824 835 0.485860 7921/8000 NonOverlappingTemplate 43 | 797 838 824 765 792 807 807 776 815 779 0.757543 7926/8000 NonOverlappingTemplate 44 | 819 790 804 808 779 779 835 827 796 763 0.744663 7895/8000 NonOverlappingTemplate 45 | 797 792 798 841 822 795 782 778 782 813 0.878618 7928/8000 NonOverlappingTemplate 46 | 825 820 823 776 785 826 792 790 795 768 0.806951 7914/8000 NonOverlappingTemplate 47 | 804 852 832 770 774 780 825 790 798 775 0.451938 7911/8000 NonOverlappingTemplate 48 | 834 764 826 754 834 828 826 746 804 784 0.129246 7914/8000 NonOverlappingTemplate 49 | 824 782 819 759 771 811 803 826 814 791 0.731634 7905/8000 NonOverlappingTemplate 50 | 781 791 826 754 805 845 803 804 841 750 0.221172 7929/8000 NonOverlappingTemplate 51 | 812 799 845 759 798 756 762 841 795 833 0.184674 7928/8000 NonOverlappingTemplate 52 | 778 872 771 825 764 781 799 753 790 867 0.021352 7930/8000 NonOverlappingTemplate 53 | 806 828 829 798 803 763 811 787 787 788 0.871053 7913/8000 NonOverlappingTemplate 54 | 810 816 784 809 791 836 807 804 787 756 0.807412 7908/8000 NonOverlappingTemplate 55 | 781 783 860 779 814 792 762 817 845 767 0.199713 7923/8000 NonOverlappingTemplate 56 | 760 819 812 766 803 828 779 782 834 817 0.551365 7932/8000 NonOverlappingTemplate 57 | 789 795 765 816 819 811 804 778 827 796 0.898292 7923/8000 NonOverlappingTemplate 58 | 812 815 848 765 774 839 749 780 806 812 0.237116 7915/8000 NonOverlappingTemplate 59 | 775 790 818 846 782 783 834 755 795 822 0.406943 7921/8000 NonOverlappingTemplate 60 | 773 777 816 831 789 767 806 851 788 802 0.525353 7925/8000 NonOverlappingTemplate 61 | 785 765 833 767 793 806 799 822 814 816 0.758528 7931/8000 NonOverlappingTemplate 62 | 796 798 799 749 826 784 794 772 843 839 0.377007 7920/8000 NonOverlappingTemplate 63 | 802 809 789 779 783 761 803 837 818 819 0.774372 7907/8000 NonOverlappingTemplate 64 | 785 792 835 812 775 788 804 782 807 820 0.910091 7925/8000 NonOverlappingTemplate 65 | 783 804 840 814 813 820 782 778 777 789 0.820143 7934/8000 NonOverlappingTemplate 66 | 754 774 862 845 836 777 775 806 771 800 0.091349 7931/8000 NonOverlappingTemplate 67 | 819 800 791 880 793 760 784 803 789 781 0.240037 7915/8000 NonOverlappingTemplate 68 | 757 827 798 812 760 792 803 811 816 824 0.669359 7920/8000 NonOverlappingTemplate 69 | 789 833 789 781 792 809 815 808 787 797 0.968863 7918/8000 NonOverlappingTemplate 70 | 801 801 751 812 782 859 770 854 755 815 0.077548 7915/8000 NonOverlappingTemplate 71 | 836 808 771 775 798 781 778 821 797 835 0.669618 7918/8000 NonOverlappingTemplate 72 | 807 803 832 788 746 846 779 781 796 822 0.396813 7928/8000 NonOverlappingTemplate 73 | 802 802 789 808 861 771 800 804 824 739 0.253443 7920/8000 NonOverlappingTemplate 74 | 787 789 811 843 811 817 784 798 774 786 0.855328 7918/8000 NonOverlappingTemplate 75 | 776 768 780 804 825 831 789 844 803 780 0.576447 7926/8000 NonOverlappingTemplate 76 | 819 792 733 834 823 845 777 808 795 774 0.191816 7913/8000 NonOverlappingTemplate 77 | 780 799 807 814 790 826 764 824 827 769 0.716696 7925/8000 NonOverlappingTemplate 78 | 794 828 780 823 820 855 768 798 763 771 0.310422 7939/8000 NonOverlappingTemplate 79 | 820 803 802 804 801 813 797 780 807 773 0.987235 7921/8000 NonOverlappingTemplate 80 | 782 784 797 824 843 740 746 837 826 821 0.090388 7933/8000 NonOverlappingTemplate 81 | 771 801 786 817 776 817 812 802 836 782 0.838645 7927/8000 NonOverlappingTemplate 82 | 777 800 765 789 813 839 846 804 752 815 0.328103 7930/8000 NonOverlappingTemplate 83 | 821 802 827 806 789 806 788 802 804 755 0.879764 7919/8000 NonOverlappingTemplate 84 | 827 776 779 798 802 845 783 805 808 777 0.754091 7908/8000 NonOverlappingTemplate 85 | 788 753 833 815 778 824 774 846 799 790 0.390288 7922/8000 NonOverlappingTemplate 86 | 805 809 842 815 803 748 762 808 813 795 0.520351 7909/8000 NonOverlappingTemplate 87 | 778 869 805 758 776 831 811 748 794 830 0.080149 7925/8000 NonOverlappingTemplate 88 | 800 748 785 809 817 835 803 810 821 772 0.603581 7912/8000 NonOverlappingTemplate 89 | 759 781 798 807 806 858 790 815 785 801 0.579279 7911/8000 NonOverlappingTemplate 90 | 800 800 787 801 811 835 824 783 815 744 0.618645 7923/8000 NonOverlappingTemplate 91 | 848 803 743 796 807 806 802 811 779 805 0.552637 7908/8000 NonOverlappingTemplate 92 | 770 785 847 784 831 789 794 793 830 777 0.561312 7919/8000 NonOverlappingTemplate 93 | 848 825 724 838 797 758 766 830 831 783 0.024897 7898/8000 NonOverlappingTemplate 94 | 786 735 831 802 820 788 840 828 781 789 0.276052 7917/8000 NonOverlappingTemplate 95 | 858 810 805 808 788 819 746 801 759 806 0.285076 7923/8000 NonOverlappingTemplate 96 | 828 762 798 802 815 775 759 878 791 792 0.131690 7908/8000 NonOverlappingTemplate 97 | 793 783 828 755 831 805 827 842 768 768 0.286660 7935/8000 NonOverlappingTemplate 98 | 801 843 794 824 813 831 765 758 769 802 0.398345 7923/8000 NonOverlappingTemplate 99 | 752 787 825 813 796 814 820 813 777 803 0.766363 7924/8000 NonOverlappingTemplate 100 | 788 829 759 844 792 794 796 746 821 831 0.256029 7916/8000 NonOverlappingTemplate 101 | 809 804 803 798 807 814 822 778 779 786 0.982198 7909/8000 NonOverlappingTemplate 102 | 802 820 758 750 806 787 851 801 776 849 0.159687 7927/8000 NonOverlappingTemplate 103 | 804 778 839 778 816 859 785 795 809 737 0.154738 7920/8000 NonOverlappingTemplate 104 | 774 773 813 833 848 784 804 780 812 779 0.556460 7922/8000 NonOverlappingTemplate 105 | 817 808 785 769 803 797 823 784 806 808 0.962177 7912/8000 NonOverlappingTemplate 106 | 775 757 812 797 736 794 804 852 827 846 0.080395 7918/8000 NonOverlappingTemplate 107 | 788 808 741 774 779 847 757 860 803 843 0.036322 7913/8000 NonOverlappingTemplate 108 | 752 779 792 814 878 837 847 749 763 789 0.012886 7929/8000 NonOverlappingTemplate 109 | 835 795 806 758 775 788 789 841 802 811 0.618125 7912/8000 NonOverlappingTemplate 110 | 811 792 755 751 782 811 871 816 803 808 0.161141 7919/8000 NonOverlappingTemplate 111 | 813 750 842 823 796 740 856 806 819 755 0.039201 7923/8000 NonOverlappingTemplate 112 | 811 786 849 862 773 781 813 775 754 796 0.152794 7924/8000 NonOverlappingTemplate 113 | 817 768 797 825 767 794 864 834 786 748 0.121262 7929/8000 NonOverlappingTemplate 114 | 759 817 835 768 786 820 838 796 813 768 0.406943 7921/8000 NonOverlappingTemplate 115 | 834 772 763 805 763 807 784 762 852 858 0.074560 7919/8000 NonOverlappingTemplate 116 | 800 792 818 801 809 804 839 796 779 762 0.844216 7927/8000 NonOverlappingTemplate 117 | 778 784 739 826 830 765 832 824 838 784 0.153655 7937/8000 NonOverlappingTemplate 118 | 839 797 776 769 812 782 817 809 818 781 0.765876 7913/8000 NonOverlappingTemplate 119 | 841 784 771 817 789 801 774 841 822 760 0.389206 7920/8000 NonOverlappingTemplate 120 | 826 836 803 779 836 779 793 775 799 774 0.648831 7934/8000 NonOverlappingTemplate 121 | 809 777 807 768 835 772 764 804 827 837 0.448658 7920/8000 NonOverlappingTemplate 122 | 812 783 822 826 759 779 751 787 862 819 0.157581 7918/8000 NonOverlappingTemplate 123 | 802 787 766 763 805 832 838 830 803 774 0.487561 7906/8000 NonOverlappingTemplate 124 | 763 804 846 790 810 779 785 773 817 833 0.524852 7930/8000 NonOverlappingTemplate 125 | 759 816 787 848 831 742 808 835 788 786 0.164653 7920/8000 NonOverlappingTemplate 126 | 829 798 805 801 792 793 807 825 782 768 0.926636 7920/8000 NonOverlappingTemplate 127 | 762 749 826 857 834 798 800 794 821 759 0.118466 7908/8000 NonOverlappingTemplate 128 | 819 784 784 772 815 827 827 790 801 781 0.855328 7898/8000 NonOverlappingTemplate 129 | 802 823 794 759 835 794 787 791 811 804 0.845278 7908/8000 NonOverlappingTemplate 130 | 837 734 790 727 811 805 792 851 821 832 0.022856 7900/8000 NonOverlappingTemplate 131 | 812 819 814 773 817 813 794 795 783 780 0.951324 7940/8000 NonOverlappingTemplate 132 | 813 816 783 799 783 809 768 784 820 825 0.895097 7913/8000 NonOverlappingTemplate 133 | 777 810 776 779 753 817 797 799 840 852 0.306153 7929/8000 NonOverlappingTemplate 134 | 818 805 800 813 823 734 808 796 796 807 0.643887 7926/8000 NonOverlappingTemplate 135 | 800 781 839 798 805 825 749 811 795 797 0.677133 7922/8000 NonOverlappingTemplate 136 | 815 731 764 797 853 810 794 819 800 817 0.193897 7911/8000 NonOverlappingTemplate 137 | 771 772 809 790 798 828 828 828 787 789 0.782541 7931/8000 NonOverlappingTemplate 138 | 792 766 769 845 799 818 808 763 835 805 0.435660 7937/8000 NonOverlappingTemplate 139 | 810 808 843 763 780 829 785 811 768 803 0.584951 7918/8000 NonOverlappingTemplate 140 | 831 782 806 814 794 792 800 758 803 820 0.856564 7927/8000 NonOverlappingTemplate 141 | 795 788 862 769 782 761 841 799 802 801 0.301742 7913/8000 NonOverlappingTemplate 142 | 806 808 779 796 812 791 783 803 817 805 0.994916 7909/8000 NonOverlappingTemplate 143 | 764 852 806 815 811 780 765 770 808 829 0.369843 7935/8000 NonOverlappingTemplate 144 | 734 854 794 811 838 777 833 804 800 755 0.074215 7923/8000 NonOverlappingTemplate 145 | 816 802 832 830 770 742 785 824 818 781 0.357205 7926/8000 NonOverlappingTemplate 146 | 775 794 793 790 769 842 797 815 787 838 0.665466 7911/8000 NonOverlappingTemplate 147 | 806 786 812 792 800 764 790 795 803 852 0.767825 7909/8000 NonOverlappingTemplate 148 | 821 790 815 779 809 762 787 851 772 814 0.523851 7919/8000 NonOverlappingTemplate 149 | 822 789 812 818 784 755 732 862 815 811 0.085327 7922/8000 NonOverlappingTemplate 150 | 803 815 806 828 769 784 767 806 825 797 0.831027 7930/8000 NonOverlappingTemplate 151 | 799 816 780 778 788 831 799 814 821 774 0.879383 7908/8000 NonOverlappingTemplate 152 | 751 825 776 812 771 821 820 800 790 834 0.498804 7917/8000 NonOverlappingTemplate 153 | 784 789 817 782 808 808 801 805 810 796 0.996551 7930/8000 NonOverlappingTemplate 154 | 835 768 850 763 822 802 781 790 800 789 0.438660 7930/8000 NonOverlappingTemplate 155 | 815 786 780 751 839 774 797 850 789 819 0.310608 7917/8000 NonOverlappingTemplate 156 | 775 762 823 819 795 780 838 804 809 795 0.721016 7910/8000 NonOverlappingTemplate 157 | 839 782 789 804 761 802 849 748 828 798 0.227773 7922/8000 NonOverlappingTemplate 158 | 779 804 812 817 831 769 801 800 798 789 0.931617 7921/8000 NonOverlappingTemplate 159 | 827 794 757 804 795 784 812 854 797 776 0.514621 7926/8000 NonOverlappingTemplate 160 | 763 788 784 828 825 787 796 835 785 809 0.728103 7932/8000 NonOverlappingTemplate 161 | 861 804 788 761 799 796 767 853 816 755 0.105696 7922/8000 NonOverlappingTemplate 162 | 763 803 798 795 774 810 822 776 807 852 0.585725 7929/8000 NonOverlappingTemplate 163 | 760 780 797 805 811 851 797 815 783 801 0.678686 7910/8000 NonOverlappingTemplate 164 | 886 821 830 789 757 787 811 738 753 828 0.007997 7904/8000 OverlappingTemplate 165 | 907 845 828 802 797 777 814 735 721 774 0.000152 7909/8000 Universal 166 | 795 778 779 839 800 793 764 825 807 820 0.728608 7928/8000 ApproximateEntropy 167 | 489 472 492 505 531 509 510 488 469 465 0.527618 4884/4930 RandomExcursions 168 | 475 493 494 506 464 483 531 491 528 465 0.356761 4891/4930 RandomExcursions 169 | 477 493 507 511 523 504 494 457 494 470 0.600635 4878/4930 RandomExcursions 170 | 524 487 485 496 487 501 484 504 494 468 0.907907 4888/4930 RandomExcursions 171 | 467 478 487 489 506 496 534 490 488 495 0.761627 4887/4930 RandomExcursions 172 | 485 468 520 496 493 483 496 483 494 512 0.907907 4896/4930 RandomExcursions 173 | 495 489 477 518 517 480 523 470 489 472 0.620018 4876/4930 RandomExcursions 174 | 542 421 500 491 480 524 488 509 520 455 0.006752 4862/4930 RandomExcursions 175 | 452 513 518 498 518 489 477 510 471 484 0.428891 4892/4930 RandomExcursionsVariant 176 | 455 540 496 499 474 464 518 523 460 501 0.081232 4896/4930 RandomExcursionsVariant 177 | 479 507 484 497 461 518 506 472 522 484 0.590973 4892/4930 RandomExcursionsVariant 178 | 472 487 500 463 531 489 473 523 491 501 0.472220 4886/4930 RandomExcursionsVariant 179 | 488 498 482 481 548 466 518 474 471 504 0.244190 4891/4930 RandomExcursionsVariant 180 | 496 486 513 521 454 519 462 500 478 501 0.382923 4893/4930 RandomExcursionsVariant 181 | 494 496 492 501 506 468 498 508 511 456 0.769153 4894/4930 RandomExcursionsVariant 182 | 491 502 480 498 470 509 458 515 473 534 0.363109 4887/4930 RandomExcursionsVariant 183 | 505 466 512 494 470 518 484 476 499 506 0.738700 4888/4930 RandomExcursionsVariant 184 | 523 495 512 477 478 490 503 485 489 478 0.884571 4887/4930 RandomExcursionsVariant 185 | 494 501 509 500 476 509 469 467 513 492 0.815729 4889/4930 RandomExcursionsVariant 186 | 474 503 490 511 457 516 496 492 515 476 0.647467 4896/4930 RandomExcursionsVariant 187 | 508 472 523 485 492 516 433 480 472 549 0.022899 4895/4930 RandomExcursionsVariant 188 | 506 514 497 467 492 477 516 506 488 467 0.739918 4878/4930 RandomExcursionsVariant 189 | 499 508 510 476 483 523 469 491 490 481 0.814993 4874/4930 RandomExcursionsVariant 190 | 498 524 509 460 509 499 454 489 482 506 0.434844 4879/4930 RandomExcursionsVariant 191 | 506 491 526 494 490 487 491 462 489 494 0.864090 4876/4930 RandomExcursionsVariant 192 | 505 491 512 531 465 487 482 468 496 493 0.620862 4874/4930 RandomExcursionsVariant 193 | 806 808 788 859 806 779 756 763 807 828 0.317187 7926/8000 Serial 194 | 792 813 824 783 814 789 774 802 798 811 0.972552 7911/8000 Serial 195 | 747 780 812 794 813 846 812 765 826 805 0.377007 7916/8000 LinearComplexity 196 | 197 | 198 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 199 | The minimum pass rate for each statistical test with the exception of the 200 | random excursion (variant) test is approximately = 7893 for a 201 | sample size = 8000 binary sequences. 202 | 203 | The minimum pass rate for the random excursion (variant) test 204 | is approximately = 4859 for a sample size = 4930 binary sequences. 205 | 206 | For further guidelines construct a probability table using the MAPLE program 207 | provided in the addendum section of the documentation. 208 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209 | --------------------------------------------------------------------------------