static inline void perm_array(int len, int *arr) {int i,j,t; /* keep arr[0], i goes from 1 */ for(i=1;i<len-1;i++){ j=i+mrandom(len-i); t=arr[i];arr[i]=arr[j];arr[j]=t; } }
cookie(int maxx, int maxy) { int i, j, val; do { i = mrandom(0,maxx/GORDO); j = mrandom(0,maxy/GORDO); val = mrandom(1,9); } while(tablero[i][j] != 0); tablero[i][j] = val; galleta.x=i*GORDO; galleta.y=j*GORDO; if(galleta_id == 0) galleta_id = create_obj_w(i*GORDO, j*GORDO, GORDO, "rectangle", "blue"); else coords_w(galleta_id, i*GORDO, j*GORDO, GORDO); }
void bernstein(char *seed){ int loops, b, j, k; mrandom(strlen(seed), seed); for(loops=4; loops<=65536; loops*=16){ for(b=0; b<16; b++){ printf("%.2d, %.5d loops:", b, loops); for(k=0; k<10; k++){ for(j=0; j<16; j++){ key[j] = xrandom() >> 16; } ExpandKey(key, expkey); printf(" %.2x", bestx(b, loops) ^ key[b]); fflush(stdout); } printf("\n"); } } }