version 1.1 | | version 1.2 |
---|
| | |
/* | | /* |
* static char *rcsid_utils_c = | | * static char *rcsid_utils_c = |
* "$Id: utils.c,v 1.1 2001/09/26 21:12:33 garbled Exp $"; | | * "$Id: utils.c,v 1.2 2001/10/01 19:10:27 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* we have a winner */ | | /* we have a winner */ |
((luck > 0) ? (luck = 1) : (luck = -1)); | | ((luck > 0) ? (luck = 1) : (luck = -1)); |
diff -= luck; | | diff -= luck; |
| | if (diff < 1) |
| | return(omin); /*check again*/ |
((goodbad) ? (min += luck) : (diff)); | | ((goodbad) ? (min += luck) : (diff)); |
| | |
return(MAX(omin, MIN(max, (RANDOM()%diff)+min))); | | return(MAX(omin, MIN(max, (RANDOM()%diff)+min))); |
| | |
gotlucky++; | | gotlucky++; |
((luck > 0) ? (luck = 1) : (luck = -1)); | | ((luck > 0) ? (luck = 1) : (luck = -1)); |
diff -= luck; | | diff -= luck; |
| | if (diff < 1) |
| | return(omin); /*check again*/ |
((goodbad) ? (min += luck) : (diff)); | | ((goodbad) ? (min += luck) : (diff)); |
total += MAX(1, MIN(size, (RANDOM()%diff)+min)); | | total += MAX(1, MIN(size, (RANDOM()%diff)+min)); |
} else { | | } else { |
| | |
{ | | { |
int diff; | | int diff; |
| | |
diff = max - min; | | diff = max - min + 1; |
if (max < 1 || diff < 1) | | if (max < 1 || diff < 1) |
return(min); | | return(min); |
| | |