summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ae8f912)
SCCS-vsn: games/random/random.c 8.4
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)random.c 8.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)random.c 8.4 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
* 0 (which has a 1 / denom chance of being true), we select the
* line.
*/
* 0 (which has a 1 / denom chance of being true), we select the
* line.
*/
- selected = !((denom * random()) / LONG_MAX);
+ selected = !(int)((denom * random()) / LONG_MAX);
while ((ch = getchar()) != EOF) {
if (selected)
(void)putchar(ch);
while ((ch = getchar()) != EOF) {
if (selected)
(void)putchar(ch);
err(2, "stdout");
/* Now see if the next line is to be printed. */
err(2, "stdout");
/* Now see if the next line is to be printed. */
- selected = !((denom * random()) / LONG_MAX);
+ selected = !(int)((denom * random()) / LONG_MAX);
(void)fprintf(stderr, "usage: random [-er] [denominator]\n");
exit(1);
}
(void)fprintf(stderr, "usage: random [-er] [denominator]\n");
exit(1);
}