ack/lang/basic/lib/random.c

28 lines
299 B
C
Raw Normal View History

1985-01-21 12:47:04 +00:00
/* $Header$ */
1984-11-29 14:22:02 +00:00
_randomi()
1984-11-29 14:22:02 +00:00
{
int i;
_setchan(-1);
1984-11-29 14:22:02 +00:00
printf("Random number seed (-32768 to 32767) ? ");
_readint(&i);
1988-07-01 17:30:06 +00:00
_setrand(i);
1984-11-29 14:22:02 +00:00
}
1988-07-01 17:30:06 +00:00
_setrand(i)
1984-11-29 14:22:02 +00:00
int i;
1988-07-01 17:30:06 +00:00
{
1984-11-29 14:22:02 +00:00
srand(i);
}
double _rnd(d) double d;
{
double f; f= (int) rand();
1988-07-01 17:30:06 +00:00
return(f/
#if EM_WSIZE == 4
2147483647.0
#else
32767.0
#endif
);
1984-11-29 14:22:02 +00:00
}