|
|
1.1.1.3 ! root 1: /* random.h - Header include file for random.c ! 2: Last revised 15 Dec 90 ! 3: (c) 1989 Philip Zimmermann. All rights reserved. ! 4: */ ! 5: ! 6: ! 7: #include "usuals.h" /* typedefs for byte, word16, boolean, etc. */ ! 8: ! 9: int pseudorand(void); /* 16-bit LCG pseudorandom generator */ ! 10: ! 11: /* Don't define PSEUDORANDOM unless you want only pseudorandom numbers. ! 12: If you do want PSEDORANDOM defined, it's better to define it right ! 13: here in this include file because then you can be sure that all the ! 14: files that include random.h will be properly affected. */ ! 15: /* #define PSEUDORANDOM */ ! 16: ! 17: #ifdef PSEUDORANDOM /* use pseudorandom numbers */ ! 18: #define randombyte() ((byte) pseudorand()) /* pseudorandom generator */ ! 19: #define randaccum(bitcount) /* null function */ ! 20: #define randload(bitcount) /* null function */ ! 21: #define randflush() /* null function */ ! 22: #define capturecounter() /* null function */ ! 23: #define keypress() kbhit() /* TRUE iff keyboard input ready */ ! 24: #define getkey() getch() /* returns data from keyboard (no echo). */ ! 25: #endif /* ifdef PSEUDORANDOM */ ! 26: ! 27: #ifndef PSEUDORANDOM /* use truly random numbers */ ! 28: ! 29: extern int randcount; /* number of random bytes accumulated in pool */ ! 30: ! 31: void capturecounter(void); /* capture a fast counter into the random pool. */ ! 32: /* Should be called when the user clicks the mouse, or from getkey(). */ ! 33: ! 34: short randombyte(void); /* returns truly random byte from pool */ ! 35: ! 36: int getstring(char *strbuf,int maxlen,boolean echo); ! 37: ! 38: void randaccum(short bitcount); /* get this many raw random bits ready */ ! 39: ! 40: short randload(short bitcount); ! 41: /* Get fresh load of raw random bits into recyclepool for key generation */ ! 42: ! 43: void randflush(void); /* flush recycled random bytes */ ! 44: ! 45: boolean keypress(void); /* TRUE iff keyboard input ready */ ! 46: #ifndef AMIGA ! 47: short getkey(void); /* returns data from keyboard (no echo). */ ! 48: #endif /* !AMIGA */ ! 49: ! 50: #endif /* ifndef PSEUDORANDOM */ ! 51:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.