ack/lang/basic/lib/random.c

26 lines
281 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;
double f;
_setchan(-1);
1984-11-29 14:22:02 +00:00
printf("Random number seed (-32768 to 32767) ? ");
_readint(&i);
f=i;
_setrand(f);
1984-11-29 14:22:02 +00:00
}
_setrand(f)
1984-11-29 14:22:02 +00:00
double f;
{
int i;
i=f;
srand(i);
}
double _rnd(d) double d;
{
double f; f= (int) rand();
return(f/32767.0);
}