View | Details | Raw Unified | Return to bug 81279
Collapse All | Expand All

(-)random.c (-3 / +3 lines)
Lines 159-165 Link Here
159
159
160
	/* Compute a random exit status between 0 and denom - 1. */
160
	/* Compute a random exit status between 0 and denom - 1. */
161
	if (random_exit)
161
	if (random_exit)
162
		return (int)((denom * random()) / LONG_MAX);
162
		return (int)((denom * random()) / INT_MAX);
163
163
164
	/*
164
	/*
165
	 * Select whether to print the first line.  (Prime the pump.)
165
	 * Select whether to print the first line.  (Prime the pump.)
Lines 167-173 Link Here
167
	 * 0 (which has a 1 / denom chance of being true), we select the
167
	 * 0 (which has a 1 / denom chance of being true), we select the
168
	 * line.
168
	 * line.
169
	 */
169
	 */
170
	selected = (int)(denom * random() / LONG_MAX) == 0;
170
	selected = (int)(denom * random() / INT_MAX) == 0;
171
	while ((ch = getchar()) != EOF) {
171
	while ((ch = getchar()) != EOF) {
172
		if (selected)
172
		if (selected)
173
			(void)putchar(ch);
173
			(void)putchar(ch);
Lines 177-183 Link Here
177
				err(2, "stdout");
177
				err(2, "stdout");
178
178
179
			/* Now see if the next line is to be printed. */
179
			/* Now see if the next line is to be printed. */
180
			selected = (int)(denom * random() / LONG_MAX) == 0;
180
			selected = (int)(denom * random() / INT_MAX) == 0;
181
		}
181
		}
182
	}
182
	}
183
	if (ferror(stdin))
183
	if (ferror(stdin))

Return to bug 81279