Index: usr/src/usr.bin/random/random.c =================================================================== --- usr/src/usr.bin/random/random.c (revision 357960) +++ usr/src/usr.bin/random/random.c (working copy) @@ -165,7 +165,7 @@ * 0 (which has a 1 / denom chance of being true), we select the * line. */ - selected = (arc4random_uniform(denom) == 0); + selected = ((int)(denom * arc4random_uniform(UINT32_MAX) / (UINT32_MAX-1)) == 0); while ((ch = getchar()) != EOF) { if (selected) (void)putchar(ch); @@ -175,7 +175,7 @@ err(2, "stdout"); /* Now see if the next line is to be printed. */ - selected = (arc4random_uniform(denom) == 0); + selected = ((int)(denom * arc4random_uniform(UINT32_MAX) / (UINT32_MAX-1)) == 0); } } if (ferror(stdin)) Index: usr/src/usr.bin/random/randomize_fd.c =================================================================== --- usr/src/usr.bin/random/randomize_fd.c (revision 357960) +++ usr/src/usr.bin/random/randomize_fd.c (working copy) @@ -218,7 +218,7 @@ if (n->cp == NULL) break; - if (arc4random_uniform(denom) == 0) { + if ((int)(denom * arc4random_uniform(UINT32_MAX) / (UINT32_MAX-1)) == 0) { ret = printf("%.*s", (int)n->len - 1, n->cp); if (ret < 0)