Skip to content

Instantly share code, notes, and snippets.

@qgp9
qgp9 / uniq_test.c
Created July 11, 2020 22:48
uniqueness test for Linear congruential generator
#include <stdio.h>
#include <time.h>
#define NSUB (1L<<32)
#define NBIT 48
//#define NSUB (1<<4)
//#define NBIT 8
#define COUNT(isub, iseg) (isub*((long)NSUB)+iseg)
#define PRINT_COUNT(msg, count) printf("%s: iSub= %ld\tcount= %ld\tr1= %ld\tr2=%ld\telapse= %f\n", msg, isub, count, r1, r2, elapse)
#define PRINT(msg) PRINT_COUNT(msg, COUNT(isub, iseg))
defscrollback 10000
autodetach on
vbell on
hardstatus alwayslastline
hardstatus string '%{= kg}[ %{y}%H %{g}][%= %{=kw}%?%-w%?%{y}(%{W}%n*%t%?(%u)%?%{y})%{g}%?%+w%?%?%= %{g}][ %{y}%Y-%m-%d %{W}%c %D %{g}]'
escape ^Aa
#shell bash
#!/usr/bin/env bash
function token_to_array() {
local -n array=$1
local str=$2
local i=0 c quote start=0
while [ $i -lt ${#str} ]; do
c=${str:$i:1}
case "$c" in
\\) i=$(( i + 1 ))