Encapsulate direct use of random(), srandom() in chance.c

Wrap roll0() around random(), and seed_prng() around srandom().  In
preparation of replacing the PRNG.
This commit is contained in:
Markus Armbruster 2012-08-14 19:23:12 +02:00
parent 8eb78a5a80
commit 866859e912
17 changed files with 87 additions and 49 deletions

View file

@ -29,6 +29,7 @@
* Known contributors to this file:
* Dave Pare, 1989
* Steve McClure, 1997
* Markus Armbruster, 2004-2012
*/
#include <config.h>
@ -169,7 +170,7 @@ damage(int amt, int pct)
return 0;
tmp = amt * pct;
lost = tmp / 100;
if (random() % 100 < tmp % 100)
if (roll0(100) < tmp % 100)
lost++;
return amt - lost;
}