|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 792 (0x318) Types: TextFile Names: »random.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Craps/random.c«
#include "types.h" #include "ext.h" #ifdef BSD42 #include <sys/time.h> #endif /* * seed the random number generator * */ seedrand() { #ifdef BSD42 struct timeval tp; struct timezone tpz; gettimeofday(&tp,&tpz); srandom((int)tp.tv_sec); #endif #ifdef BSD29 randomize(); #endif #ifdef SYSV long seed; long time(); void srand48(); time(&seed); srand48(seed); #endif #ifdef XENIX long seed; long time(); time(&seed); srand(seed); #endif } /* * get_rand - return a random number 1-6 * */ get_rand() { #ifdef BSD42 long random(); return( (int) random() % 6 + 1); #endif #ifdef BSD29 double ranm(); return( (int) (ranm() * 6.0) + 1.0); #endif #ifdef SYSV double drand48(); return( (int) (drand48() * 6.0) + 1.0); #endif #ifdef XENIX return( rand() % 6 + 1); #endif }