-/* Utility routines (SETBIT, TSTBIT, set_seed_from_time, get_next_lcg_value, randrange, RNDVOC, BUG) */
+/* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value,
+ * randrange, RNDVOC, BUG) */
#undef SETBIT
long fSETBIT(long BIT) {
#define TSTBIT(MASK,BIT) fTSTBIT(MASK,BIT)
-void set_seed_from_time(void)
+void set_seed(long seedval)
{
- /* Use the current system time to get seed the ISO rand() function, from which we get a seed for the LCG. */
- srand(time(NULL));
- lcgstate.x = (unsigned long) rand() % lcgstate.m;
+ lcgstate.x = (unsigned long) seedval % lcgstate.m;
}
unsigned long get_next_lcg_value(void)
#define IABS(N) fIABS(N)
extern long fMOD(long,long);
#define MOD(N,M) fMOD(N,M)
-extern void set_seed_from_time(void);
+extern void set_seed(long);
extern unsigned long get_next_lcg_value(void);
extern long randrange(long);