OSDN Git Service

ハャ、ォ、熙荀ケ、、、隍ヲ、ヒ。「rand_int()、andint0()。「randint()、andint1()、ヒ、ケ、ル、ニテヨ、ュハム、ィ、ソ。」
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 15 Feb 2002 13:49:18 +0000 (13:49 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 15 Feb 2002 13:49:18 +0000 (13:49 +0000)
、ウ、ホテヨエケ、マエハテア、ハ、ホ、ヌエヨー网テ、ニ、ハ、、、ネサラ、ヲ。」

45 files changed:
src/artifact.c
src/avatar.c
src/birth.c
src/bldg.c
src/cave.c
src/cmd1.c
src/cmd2.c
src/cmd4.c
src/cmd5.c
src/cmd6.c
src/dungeon.c
src/effects.c
src/files.c
src/flavor.c
src/generate.c
src/grid.c
src/grid.h
src/hissatsu.c
src/init1.c
src/load.c
src/main-dos.c
src/mane.c
src/melee1.c
src/melee2.c
src/mind.c
src/monster1.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/mspells3.c
src/mutation.c
src/object2.c
src/racial.c
src/rooms.c
src/save.c
src/spells1.c
src/spells2.c
src/spells3.c
src/store.c
src/streams.c
src/wild.c
src/wizard2.c
src/xtra2.c
src/z-rand.c
src/z-rand.h

index fddc4c1..1bd5d22 100644 (file)
 
 static void curse_artifact(object_type * o_ptr)
 {
-       if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint(4));
-       if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint(4));
-       if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint(4));
-       if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint(4));
+       if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint1(4));
+       if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint1(4));
+       if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint1(4));
+       if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint1(4));
 
        o_ptr->art_flags3 |= (TR3_HEAVY_CURSE | TR3_CURSED);
 
@@ -184,7 +184,7 @@ static void random_plus(object_type * o_ptr, bool is_scroll)
                }
        }
 
-       switch (randint(this_type))
+       switch (randint1(this_type))
        {
        case 1: case 2:
                o_ptr->art_flags1 |= TR1_STR;
@@ -412,7 +412,7 @@ void random_resistance(object_type * o_ptr, bool is_scroll, int specific)
                }
        }
 
-       switch (specific ? specific : randint(42))
+       switch (specific ? specific : randint1(42))
        {
                case 1:
                        if (!one_in_(WEIRD_LUCK))
@@ -672,7 +672,7 @@ static void random_misc(object_type * o_ptr, bool is_scroll)
                }
        }
 
-       switch (randint(31))
+       switch (randint1(31))
        {
                case 1:
                        o_ptr->art_flags2 |= TR2_SUST_STR;
@@ -768,7 +768,7 @@ static void random_misc(object_type * o_ptr, bool is_scroll)
                                random_misc(o_ptr, is_scroll);
                        else
                        {
-                               o_ptr->to_a = 4 + randint(11);
+                               o_ptr->to_a = 4 + randint1(11);
                        }
                        break;
                case 27:
@@ -777,8 +777,8 @@ static void random_misc(object_type * o_ptr, bool is_scroll)
                {
                        int bonus_h, bonus_d;
                        o_ptr->art_flags3 |= TR3_SHOW_MODS;
-                       bonus_h = 4 + (randint(11));
-                       bonus_d = 4 + (randint(11));
+                       bonus_h = 4 + (randint1(11));
+                       bonus_d = 4 + (randint1(11));
                        if ((o_ptr->tval != TV_SWORD) && (o_ptr->tval != TV_POLEARM) && (o_ptr->tval != TV_HAFTED) && (o_ptr->tval != TV_DIGGING) && (o_ptr->tval != TV_GLOVES) && (o_ptr->tval != TV_RING))
                        {
                                bonus_h /= 2;
@@ -922,7 +922,7 @@ static void random_slay(object_type *o_ptr, bool is_scroll)
 
        if (o_ptr->tval != TV_BOW)
        {
-               switch (randint(34))
+               switch (randint1(34))
                {
                        case 1:
                        case 2:
@@ -1053,7 +1053,7 @@ static void random_slay(object_type *o_ptr, bool is_scroll)
        }
        else
        {
-               switch (randint(6))
+               switch (randint1(6))
                {
                        case 1:
                        case 2:
@@ -1244,9 +1244,9 @@ static void give_activation_power(object_type *o_ptr)
                }
        }
 
-       while (!type || (randint(100) >= chance))
+       while (!type || (randint1(100) >= chance))
        {
-               type = randint(255);
+               type = randint1(255);
                switch (type)
                {
                        case ACT_SUNLIGHT:
@@ -1355,7 +1355,7 @@ static void give_activation_power(object_type *o_ptr)
 
 static void get_random_name(char *return_name, bool armour, int power)
 {
-       if (randint(100) <= TABLE_NAME)
+       if (randint1(100) <= TABLE_NAME)
        {
                get_table_name(return_name);
        }
@@ -1450,7 +1450,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 {
        char    new_name[1024];
        int     has_pval = 0;
-       int     powers = randint(5) + 1;
+       int     powers = randint1(5) + 1;
        int     max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
        int     power_level;
        s32b    total_flags;
@@ -1519,20 +1519,20 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                                break;
                        case CLASS_MINDCRAFTER:
                        case CLASS_BARD:
-                               if (randint(5) > 2) artifact_bias = BIAS_PRIESTLY;
+                               if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
                                break;
                        case CLASS_TOURIST:
-                               if (randint(5) > 2) artifact_bias = BIAS_WARRIOR;
+                               if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
                                break;
                        case CLASS_IMITATOR:
-                               if (randint(2) > 1) artifact_bias = BIAS_RANGER;
+                               if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
                                break;
                        case CLASS_BEASTMASTER:
                                artifact_bias = BIAS_CHR;
                                warrior_artifact_bias = 50;
                                break;
                        case CLASS_MIRROR_MASTER:
-                               if (randint(4) > 1) 
+                               if (randint1(4) > 1) 
                                {
                                    artifact_bias = BIAS_MAGE;
                                }
@@ -1544,7 +1544,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                }
        }
 
-       if (a_scroll && (randint(100) <= warrior_artifact_bias))
+       if (a_scroll && (randint1(100) <= warrior_artifact_bias))
                artifact_bias = BIAS_WARRIOR;
 
        strcpy(new_name, "");
@@ -1565,7 +1565,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        /* Main loop */
        while (powers--)
        {
-               switch (randint(max_type))
+               switch (randint1(max_type))
                {
                        case 1: case 2:
                                random_plus(o_ptr, a_scroll);
@@ -1611,7 +1611,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
                if (o_ptr->art_flags1 & TR1_BLOWS)
                {
-                       o_ptr->pval = randint(2);
+                       o_ptr->pval = randint1(2);
                        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
                                o_ptr->pval++;
                }
@@ -1621,7 +1621,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                        {
                                o_ptr->pval++;
                        }
-                       while (o_ptr->pval < randint(5) || one_in_(o_ptr->pval));
+                       while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
                }
 
                if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
@@ -1630,11 +1630,11 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 
        /* give it some plusses... */
        if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
-               o_ptr->to_a += randint(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
+               o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
        else if (o_ptr->tval <= TV_SWORD)
        {
-               o_ptr->to_h += randint(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
-               o_ptr->to_d += randint(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
+               o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
+               o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
                if ((o_ptr->art_flags1 & TR1_WIS) && (o_ptr->pval > 0)) o_ptr->art_flags3 |= TR3_BLESSED;
        }
 
@@ -1648,7 +1648,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        if (a_cursed) curse_artifact(o_ptr);
 
        if (!a_cursed &&
-           (randint((o_ptr->tval >= TV_BOOTS)
+           (randint1((o_ptr->tval >= TV_BOOTS)
            ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
        {
                o_ptr->xtra2 = 0;
@@ -1660,14 +1660,14 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                while ((o_ptr->to_d+o_ptr->to_h) > 20)
                {
                        if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
-                       o_ptr->to_d -= (s16b)rand_int(3);
-                       o_ptr->to_h -= (s16b)rand_int(3);
+                       o_ptr->to_d -= (s16b)randint0(3);
+                       o_ptr->to_h -= (s16b)randint0(3);
                }
                while ((o_ptr->to_d+o_ptr->to_h) > 10)
                {
                        if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
-                       o_ptr->to_d -= (s16b)rand_int(3);
-                       o_ptr->to_h -= (s16b)rand_int(3);
+                       o_ptr->to_d -= (s16b)randint0(3);
+                       o_ptr->to_h -= (s16b)randint0(3);
                }
        }
 
@@ -1835,7 +1835,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_POIS, dir, 12, 3);
-                       o_ptr->timeout = rand_int(4) + 4;
+                       o_ptr->timeout = randint0(4) + 4;
                        break;
                }
 
@@ -1849,7 +1849,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                       o_ptr->timeout = rand_int(5) + 5;
+                       o_ptr->timeout = randint0(5) + 5;
                        break;
                }
 
@@ -1863,7 +1863,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ACID, dir, damroll(5, 8));
-                       o_ptr->timeout = rand_int(6) + 6;
+                       o_ptr->timeout = randint0(6) + 6;
                        break;
                }
 
@@ -1877,7 +1877,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_COLD, dir, damroll(6, 8));
-                       o_ptr->timeout = rand_int(7) + 7;
+                       o_ptr->timeout = randint0(7) + 7;
                        break;
                }
 
@@ -1891,7 +1891,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                       o_ptr->timeout = rand_int(8) + 8;
+                       o_ptr->timeout = randint0(8) + 8;
                        break;
                }
 
@@ -1933,7 +1933,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        if (drain_life(dir, 100))
-                       o_ptr->timeout = rand_int(100) + 100;
+                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
@@ -2001,7 +2001,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ARROW, dir, 150);
-                       o_ptr->timeout = rand_int(90) + 90;
+                       o_ptr->timeout = randint0(90) + 90;
                        break;
                }
 
@@ -2015,7 +2015,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_FIRE, dir, 120, 3);
-                       o_ptr->timeout = rand_int(225) + 225;
+                       o_ptr->timeout = randint0(225) + 225;
                        break;
                }
 
@@ -2029,7 +2029,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_COLD, dir, 200, 3);
-                       o_ptr->timeout = rand_int(325) + 325;
+                       o_ptr->timeout = randint0(325) + 325;
                        break;
                }
 
@@ -2043,7 +2043,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ELEC, dir, 250, 3);
-                       o_ptr->timeout = rand_int(425) + 425;
+                       o_ptr->timeout = randint0(425) + 425;
                        break;
                }
 
@@ -2122,7 +2122,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        dispel_evil(p_ptr->lev * 5);
-                       o_ptr->timeout = rand_int(300) + 300;
+                       o_ptr->timeout = randint0(300) + 300;
                        break;
                }
 
@@ -2135,7 +2135,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        dispel_good(p_ptr->lev * 5);
-                       o_ptr->timeout = rand_int(300) + 300;
+                       o_ptr->timeout = randint0(300) + 300;
                        break;
                }
 
@@ -2215,7 +2215,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        }
-                       o_ptr->timeout = 250 + randint(250);
+                       o_ptr->timeout = 250 + randint1(250);
                        break;
                }
 
@@ -2288,7 +2288,7 @@ bool activate_random_artifact(object_type * o_ptr)
                case ACT_SUMMON_ANIMAL:
                {
                        (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, TRUE, TRUE, TRUE, FALSE, FALSE);
-                       o_ptr->timeout = 200 + randint(300);
+                       o_ptr->timeout = 200 + randint1(300);
                        break;
                }
 
@@ -2301,7 +2301,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, TRUE, TRUE, TRUE, FALSE, FALSE);
-                       o_ptr->timeout = 200 + randint(200);
+                       o_ptr->timeout = 200 + randint1(200);
                        break;
                }
 
@@ -2368,7 +2368,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        }
 
-                       o_ptr->timeout = 666 + randint(333);
+                       o_ptr->timeout = 666 + randint1(333);
                        break;
                }
 
@@ -2416,7 +2416,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        }
 
-                       o_ptr->timeout = 666 + randint(333);
+                       o_ptr->timeout = 666 + randint1(333);
                        break;
                }
 
@@ -2440,7 +2440,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        hp_player(damroll(4, 8));
                        (void)set_cut((p_ptr->cut / 2) - 50);
-                       o_ptr->timeout = rand_int(3) + 3;
+                       o_ptr->timeout = randint0(3) + 3;
                        break;
                }
 
@@ -2534,16 +2534,16 @@ bool activate_random_artifact(object_type * o_ptr)
 
                case ACT_ESP:
                {
-                       (void)set_tim_esp(randint(30) + 25, FALSE);
+                       (void)set_tim_esp(randint1(30) + 25, FALSE);
                        o_ptr->timeout = 200;
                        break;
                }
 
                case ACT_BERSERK:
                {
-                       (void)set_hero(randint(50) + 50, FALSE);
-                       (void)set_blessed(randint(50) + 50, FALSE);
-                       o_ptr->timeout = 100 + randint(100);
+                       (void)set_hero(randint1(50) + 50, FALSE);
+                       (void)set_blessed(randint1(50) + 50, FALSE);
+                       o_ptr->timeout = 100 + randint1(100);
                        break;
                }
 
@@ -2556,8 +2556,8 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        k = 3 * p_ptr->lev;
-                       (void)set_protevil(randint(25) + k, FALSE);
-                       o_ptr->timeout = rand_int(225) + 225;
+                       (void)set_protevil(randint1(25) + k, FALSE);
+                       o_ptr->timeout = randint0(225) + 225;
                        break;
                }
 
@@ -2569,11 +2569,11 @@ bool activate_random_artifact(object_type * o_ptr)
                        msg_print("It glows many colours...");
 #endif
 
-                       (void)set_oppose_acid(randint(40) + 40, FALSE);
-                       (void)set_oppose_elec(randint(40) + 40, FALSE);
-                       (void)set_oppose_fire(randint(40) + 40, FALSE);
-                       (void)set_oppose_cold(randint(40) + 40, FALSE);
-                       (void)set_oppose_pois(randint(40) + 40, FALSE);
+                       (void)set_oppose_acid(randint1(40) + 40, FALSE);
+                       (void)set_oppose_elec(randint1(40) + 40, FALSE);
+                       (void)set_oppose_fire(randint1(40) + 40, FALSE);
+                       (void)set_oppose_cold(randint1(40) + 40, FALSE);
+                       (void)set_oppose_pois(randint1(40) + 40, FALSE);
                        o_ptr->timeout = 200;
                        break;
                }
@@ -2586,7 +2586,7 @@ bool activate_random_artifact(object_type * o_ptr)
                        msg_print("It glows bright green...");
 #endif
 
-                       (void)set_fast(randint(20) + 20, FALSE);
+                       (void)set_fast(randint1(20) + 20, FALSE);
                        o_ptr->timeout = 250;
                        break;
                }
@@ -2599,21 +2599,21 @@ bool activate_random_artifact(object_type * o_ptr)
                        msg_print("It glows brightly...");
 #endif
 
-                       (void)set_fast(randint(75) + 75, FALSE);
-                       o_ptr->timeout = rand_int(200) + 200;
+                       (void)set_fast(randint1(75) + 75, FALSE);
+                       o_ptr->timeout = randint0(200) + 200;
                        break;
                }
 
                case ACT_WRAITH:
                {
-                       set_wraith_form(randint(plev / 2) + (plev / 2), FALSE);
+                       set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
                        o_ptr->timeout = 1000;
                        break;
                }
 
                case ACT_INVULN:
                {
-                       (void)set_invuln(randint(8) + 8, FALSE);
+                       (void)set_invuln(randint1(8) + 8, FALSE);
                        o_ptr->timeout = 1000;
                        break;
                }
@@ -2629,7 +2629,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        lite_area(damroll(2, 15), 3);
-                       o_ptr->timeout = rand_int(10) + 10;
+                       o_ptr->timeout = randint0(10) + 10;
                        break;
                }
 
@@ -2643,7 +2643,7 @@ bool activate_random_artifact(object_type * o_ptr)
 
                        map_area(DETECT_RAD_MAP);
                        lite_area(damroll(2, 15), 3);
-                       o_ptr->timeout = rand_int(50) + 50;
+                       o_ptr->timeout = randint0(50) + 50;
                        break;
                }
 
@@ -2662,7 +2662,7 @@ bool activate_random_artifact(object_type * o_ptr)
 #endif
 
                        detect_all(DETECT_RAD_DEFAULT);
-                       o_ptr->timeout = rand_int(55) + 55;
+                       o_ptr->timeout = randint0(55) + 55;
                        break;
                }
 
@@ -2873,16 +2873,16 @@ void random_artifact_resistance(object_type * o_ptr)
        if (o_ptr->name1 == ART_BLOOD)
        {
                int dummy, i;
-               dummy = randint(2)+randint(2);
+               dummy = randint1(2)+randint1(2);
                for (i = 0; i < dummy; i++)
-                       o_ptr->art_flags1 |= (TR1_CHAOTIC << rand_int(18));
-               dummy = randint(2);
+                       o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
+               dummy = randint1(2);
                for (i = 0; i < dummy; i++)
-                       random_resistance(o_ptr, FALSE, randint(34) + 4);
+                       random_resistance(o_ptr, FALSE, randint1(34) + 4);
                dummy = 2;
                for (i = 0; i < dummy; i++)
                {
-                       int tmp = rand_int(11);
+                       int tmp = randint0(11);
                        if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
                        else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
                }
@@ -2958,14 +2958,14 @@ void random_artifact_resistance(object_type * o_ptr)
                o_ptr->xtra1 = EGO_XTRA_ABILITY;
 
                /* Randomize the "xtra" power */
-               if (o_ptr->xtra1) o_ptr->xtra2 = randint(256);
+               if (o_ptr->xtra1) o_ptr->xtra2 = randint1(256);
        }
 
        artifact_bias = 0;
 
        if (give_resistance)
        {
-               random_resistance(o_ptr, FALSE, randint(22) + 16);
+               random_resistance(o_ptr, FALSE, randint1(22) + 16);
        }
 }
 
index 361fd51..0d41255 100644 (file)
@@ -188,7 +188,7 @@ void get_random_virtue(int which)
   /* Randomly choose a type */
   while (!(type) || virtue_number(type))
   {
-   switch (randint(29))
+   switch (randint1(29))
    {
         case 1: case 2: case 3:
               type = V_SACRIFICE;
index 42bc0bc..fb4c5e2 100644 (file)
@@ -2183,7 +2183,7 @@ static byte choose_realm(s32b choices, int *count)
                {
                        if(cs == n)
                        {
-                               k = rand_int(n);
+                               k = randint0(n);
                                break;
                        }
                        else
@@ -2194,7 +2194,7 @@ static byte choose_realm(s32b choices, int *count)
                }
                if (c == '*')
                {
-                       k = rand_int(n);
+                       k = randint0(n);
                        break;
                }
                if (c == '8')
@@ -2603,7 +2603,7 @@ static void get_stats(void)
                for (j = i = 0; i < 18; i++)
                {
                        /* Roll the dice */
-                       dice[i] = randint(3 + i % 3);
+                       dice[i] = randint1(3 + i % 3);
 
                        /* Collect the maximum */
                        j += dice[i];
@@ -2648,7 +2648,7 @@ void get_max_stats(void)
                for (j = i = 0; i < 6; i++)
                {
                        /* Roll the dice */
-                       dice[i] = randint(7);
+                       dice[i] = randint1(7);
 
                        /* Collect the maximum */
                        j += dice[i];
@@ -2757,14 +2757,14 @@ static void get_extra(void)
 
                for (i = 1; i < 4; i++)
                {
-                       j = randint(p_ptr->hitdie);
+                       j = randint1(p_ptr->hitdie);
                        player_hp[0] += j;
                }
 
                /* Roll the hitpoint values */
                for (i = 1; i < PY_MAX_LEVEL; i++)
                {
-                       j = randint(p_ptr->hitdie);
+                       j = randint1(p_ptr->hitdie);
                        player_hp[i] = player_hp[i - 1] + j;
                }
 
@@ -2801,7 +2801,7 @@ static void get_history(void)
        buf[0] = '\0';
 
        /* Initial social class */
-       social_class = randint(4);
+       social_class = randint1(4);
 
        /* Starting place */
        switch (p_ptr->prace)
@@ -2994,7 +2994,7 @@ static void get_history(void)
                i = 0;
 
                /* Roll for nobility */
-               roll = randint(100);
+               roll = randint1(100);
 
 
                /* Access the proper entry in the table */
@@ -3051,7 +3051,7 @@ static void get_ahw(void)
 
 
   /* Calculate the age */
-  p_ptr->age = rp_ptr->b_age + randint(rp_ptr->m_age);
+  p_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
   
   /* Calculate the height/weight for males */
   if (p_ptr->psex == SEX_MALE)
@@ -3080,7 +3080,7 @@ static void get_money(void)
        int i, gold;
 
        /* Social Class determines starting gold */
-       gold = (p_ptr->sc * 6) + randint(100) + 300;
+       gold = (p_ptr->sc * 6) + randint1(100) + 300;
        if (p_ptr->pclass == CLASS_TOURIST)
          gold += 2000;
 
@@ -3868,7 +3868,7 @@ static bool get_player_race(void)
                {
                        if(cs == MAX_RACES)
                        {
-                               k = rand_int(MAX_RACES);
+                               k = randint0(MAX_RACES);
                                cs = k;
                                continue;
                        }
@@ -3880,7 +3880,7 @@ static bool get_player_race(void)
                }
                if (c == '*')
                {
-                       k = rand_int(MAX_RACES);
+                       k = randint0(MAX_RACES);
                        cs = k;
                        continue;
                }
@@ -4080,7 +4080,7 @@ static bool get_player_class(void)
                {
                        if(cs == MAX_CLASS_CHOICE)
                        {
-                               k = rand_int(MAX_CLASS_CHOICE);
+                               k = randint0(MAX_CLASS_CHOICE);
                                cs = k;
                                continue;
                        }
@@ -4092,7 +4092,7 @@ static bool get_player_class(void)
                }
                if (c == '*')
                {
-                       k = rand_int(MAX_CLASS_CHOICE);
+                       k = randint0(MAX_CLASS_CHOICE);
                        cs = k;
                        continue;
                }
@@ -4275,7 +4275,7 @@ static bool get_player_seikaku(void)
                        {
                                do
                                {
-                                       k = rand_int(MAX_SEIKAKU);
+                                       k = randint0(MAX_SEIKAKU);
                                }
                                while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
                                cs = k;
@@ -4291,7 +4291,7 @@ static bool get_player_seikaku(void)
                {
                        do
                        {
-                               k = rand_int(n);
+                               k = randint0(n);
                        }
                        while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
                        cs = k;
@@ -5102,14 +5102,14 @@ static bool player_birth_aux(void)
                if (c == ' ' || c == '\r' || c == '\n')
                {
                        if(cs == MAX_SEXES)
-                               k = rand_int(MAX_SEXES);
+                               k = randint0(MAX_SEXES);
                        else
                                k = cs;
                        break;
                }
                if (c == '*')
                {
-                       k = rand_int(MAX_SEXES);
+                       k = randint0(MAX_SEXES);
                        break;
                }
                if (c == '4')
@@ -5347,7 +5347,7 @@ static bool player_birth_aux(void)
                        if (inp[0] == '*')
                        {
                                /* 0 to 49 random quests */
-                               v = rand_int(11);
+                               v = randint0(11);
                        }
                        else
                        {
@@ -5390,7 +5390,7 @@ static bool player_birth_aux(void)
                         * Random monster 5 - 10 levels out of depth
                         * (depending on level)
                         */
-                       r_idx = get_mon_num(q_ptr->level + 5 + randint(q_ptr->level / 10));
+                       r_idx = get_mon_num(q_ptr->level + 5 + randint1(q_ptr->level / 10));
                        r_ptr = &r_info[r_idx];
 
                        if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
@@ -5659,7 +5659,7 @@ static bool player_birth_aux(void)
                get_money();
 
                /* Hack -- get a chaos patron even if you are not a chaos warrior */
-               p_ptr->chaos_patron = (s16b)rand_int(MAX_PATRON);
+               p_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
 
                p_ptr->muta1 = 0;
                p_ptr->muta2 = 0;
index 34df68f..010d63c 100644 (file)
@@ -564,7 +564,7 @@ static void reset_deck(int deck[])
 
        /* shuffle cards */
        for (i = 0; i < 53; i++){
-               int tmp1 = rand_int(53 - i) + i;
+               int tmp1 = randint0(53 - i) + i;
                int tmp2 = deck[i];
                deck[i] = deck[tmp1];
                deck[tmp1] = tmp2;
@@ -1364,9 +1364,9 @@ c_put_str(TERM_GREEN, "
 
                                        odds = 4;
                                        win = FALSE;
-                                       roll1 = randint(10);
-                                       roll2 = randint(10);
-                                       choice = randint(10);
+                                       roll1 = randint1(10);
+                                       roll2 = randint1(10);
+                                       choice = randint1(10);
 #ifdef JP
 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d        ¹õ¥À¥¤¥¹: %d", roll1, roll2);
 #else
@@ -1394,8 +1394,8 @@ c_put_str(TERM_GREEN, "
 
                                        win = 3;
                                        odds = 2;
-                                       roll1 = randint(6);
-                                       roll2 = randint(6);
+                                       roll1 = randint1(6);
+                                       roll2 = randint1(6);
                                        roll3 = roll1 +  roll2;
                                        choice = roll3;
 #ifdef JP
@@ -1420,8 +1420,8 @@ msg_print("
 #endif
 
                                                        msg_print(NULL);
-                                                       roll1 = randint(6);
-                                                       roll2 = randint(6);
+                                                       roll1 = randint1(6);
+                                                       roll2 = randint1(6);
                                                        roll3 = roll1 +  roll2;
 
 #ifdef JP
@@ -1480,7 +1480,7 @@ msg_print("
                                                choice = 9;
                                        }
                                        msg_print(NULL);
-                                       roll1 = rand_int(10);
+                                       roll1 = randint0(10);
 #ifdef JP
 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
 #else
@@ -1510,7 +1510,7 @@ c_put_str(TERM_GREEN, "
 #endif
 
                                        win = FALSE;
-                                       roll1 = randint(21);
+                                       roll1 = randint1(21);
                                        for (i=6;i>0;i--)
                                        {
                                                if ((roll1-i) < 1)
@@ -1520,7 +1520,7 @@ c_put_str(TERM_GREEN, "
                                                }
                                                roll1 -= i;
                                        }
-                                       roll2 = randint(21);
+                                       roll2 = randint1(21);
                                        for (i=6;i>0;i--)
                                        {
                                                if ((roll2-i) < 1)
@@ -1530,7 +1530,7 @@ c_put_str(TERM_GREEN, "
                                                }
                                                roll2 -= i;
                                        }
-                                       choice = randint(21);
+                                       choice = randint1(21);
                                        for (i=6;i>0;i--)
                                        {
                                                if ((choice-i) < 1)
@@ -1709,15 +1709,15 @@ void battle_monsters(void)
        for (i = 0; i < max_d_idx; i++)
                if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
 
-       mon_level = randint(MIN(max_dl, 122))+5;
-       if (rand_int(100) < 60)
+       mon_level = randint1(MIN(max_dl, 122))+5;
+       if (randint0(100) < 60)
        {
-               i = randint(MIN(max_dl, 122))+5;
+               i = randint1(MIN(max_dl, 122))+5;
                mon_level = MAX(i, mon_level);
        }
-       if (rand_int(100) < 30)
+       if (randint0(100) < 30)
        {
-               i = randint(MIN(max_dl, 122))+5;
+               i = randint1(MIN(max_dl, 122))+5;
                mon_level = MAX(i, mon_level);
        }
 
@@ -1906,8 +1906,8 @@ void battle_monsters(void)
                {
                        power[i] = total*60/power[i];
                        if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
-                       if ((power[i] < 160) && rand_int(20)) break;
-                       if (power[i] < 101) power[i] = 100 + randint(5);
+                       if ((power[i] < 160) && randint0(20)) break;
+                       if (power[i] < 101) power[i] = 100 + randint1(5);
                        mon_odds[i] = power[i];
                }
                if (i == 4) break;
@@ -2439,12 +2439,12 @@ msg_format("%s%s
                msg_format("You behold the %s visage of %s!",
 #endif
 
-                                         funny_desc[rand_int(MAX_SAN_FUNNY)], m_name);
+                                         funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
 
                if (one_in_(3))
                {
-                       msg_print(funny_comments[rand_int(MAX_SAN_COMMENT)]);
-                       p_ptr->image = p_ptr->image + randint(r_ptr->level);
+                       msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
+                       p_ptr->image = p_ptr->image + randint1(r_ptr->level);
                }
 
                /* Never mind; we can't see it clearly enough */
@@ -2458,7 +2458,7 @@ msg_format("%s%s
        msg_format("You behold the %s visage of %s!",
 #endif
 
-                                 horror_desc[rand_int(MAX_SAN_HORROR)], desc);
+                                 horror_desc[randint0(MAX_SAN_HORROR)], desc);
 
        r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
 
@@ -2485,11 +2485,11 @@ msg_format("%s%s
        {
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->resist_chaos && one_in_(3))
                {
-                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                       (void)set_image(p_ptr->image + randint0(250) + 150);
                }
                return;
        }
@@ -2507,11 +2507,11 @@ msg_format("%s%s
        {
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->free_act)
                {
-                       (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
                }
                while (!saving_throw(p_ptr->skill_sav))
                {
@@ -2523,7 +2523,7 @@ msg_format("%s%s
                }
                if (!p_ptr->resist_chaos)
                {
-                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                       (void)set_image(p_ptr->image + randint0(250) + 150);
                }
                return;
        }
@@ -2555,7 +2555,7 @@ msg_print("
 
        while (!happened)
        {
-               switch (randint(4))
+               switch (randint1(4))
                {
                        case 1:
                        {
@@ -2968,24 +2968,24 @@ put_str("
                        if (q_ptr->r_idx == 0)
                        {
                                /* Random monster at least 5 - 10 levels out of deep */
-                               q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint(6));
+                               q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
                        }
 
                        r_ptr = &r_info[q_ptr->r_idx];
 
                        while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
                        {
-                               q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint(6);
+                               q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
                                r_ptr = &r_info[q_ptr->r_idx];
                        }
 
                        if (q_ptr->max_num == 0)
                        {
                                /* Random monster number */
-                               if (randint(10) > 7)
+                               if (randint1(10) > 7)
                                        q_ptr->max_num = 1;
                                else
-                                       q_ptr->max_num = randint(3) + 1;
+                                       q_ptr->max_num = randint1(3) + 1;
                        }
 
                        q_ptr->cur_num = 0;
index 9332a81..3396530 100644 (file)
@@ -534,26 +534,26 @@ static void image_monster(byte *ap, char *cp)
                /* Normal graphics */
                if (!(streq(ANGBAND_SYS, "ibm")))
                {
-                       (*cp) = r_info[randint(max_r_idx-1)].x_char;
-                       (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+                       (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+                       (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
                }
                else
                /* IBM-pseudo graphics */
                {
                        n = strlen(image_monster_hack_ibm);
-                       (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+                       (*cp) = (image_monster_hack_ibm[randint0(n)]);
 
                        /* Random color */
-                       (*ap) = randint(15);
+                       (*ap) = randint1(15);
                }
        }
        else
        /* Text mode */
        {
-               (*cp) = (image_monster_hack[rand_int(n)]);
+               (*cp) = (image_monster_hack[randint0(n)]);
 
                /* Random color */
-               (*ap) = randint(15);
+               (*ap) = randint1(15);
        }
 }
 
@@ -579,24 +579,24 @@ static void image_object(byte *ap, char *cp)
        {
                if (!(streq(ANGBAND_SYS, "ibm")))
                {
-                       (*cp) = k_info[randint(max_k_idx-1)].x_char;
-                       (*ap) = k_info[randint(max_k_idx-1)].x_attr;
+                       (*cp) = k_info[randint1(max_k_idx-1)].x_char;
+                       (*ap) = k_info[randint1(max_k_idx-1)].x_attr;
                }
                else
                {
                        n = strlen(image_object_hack_ibm);
-                       (*cp) = (image_object_hack_ibm[rand_int(n)]);
+                       (*cp) = (image_object_hack_ibm[randint0(n)]);
 
                        /* Random color */
-                       (*ap) = randint(15);
+                       (*ap) = randint1(15);
                }
        }
        else
        {
-               (*cp) = (image_object_hack[rand_int(n)]);
+               (*cp) = (image_object_hack[randint0(n)]);
 
                /* Random color */
-               (*ap) = randint(15);
+               (*ap) = randint1(15);
        }
 }
 
@@ -608,7 +608,7 @@ static void image_object(byte *ap, char *cp)
 static void image_random(byte *ap, char *cp)
 {
        /* Normally, assume monsters */
-       if (rand_int(100) < 75)
+       if (randint0(100) < 75)
        {
                image_monster(ap, cp);
        }
@@ -1364,7 +1364,7 @@ void map_info(int y, int x, byte *ap, char *cp)
        }
 
        /* Hack -- rare random hallucination, except on outer dungeon walls */
-       if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !rand_int(256))
+       if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !randint0(256))
        {
                /* Hallucinate */
                image_random(ap, cp);
@@ -1481,23 +1481,23 @@ void map_info(int y, int x, byte *ap, char *cp)
                                        {
                                                if (!(streq(ANGBAND_SYS, "ibm")))
                                                {
-                                                       (*cp) = r_info[randint(max_r_idx-1)].x_char;
-                                                       (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+                                                       (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+                                                       (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
                                                }
                                                else
                                                {
                                                        int n =  strlen(image_monster_hack_ibm);
-                                                       (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+                                                       (*cp) = (image_monster_hack_ibm[randint0(n)]);
 
                                                        /* Random color */
-                                                       (*ap) = randint(15);
+                                                       (*ap) = randint1(15);
                                                }
                                        }
                                        else
                                        {
                                                (*cp) = (one_in_(25) ?
-                                                       image_object_hack[rand_int(strlen(image_object_hack))] :
-                                                       image_monster_hack[rand_int(strlen(image_monster_hack))]);
+                                                       image_object_hack[randint0(strlen(image_object_hack))] :
+                                                       image_monster_hack[randint0(strlen(image_monster_hack))]);
                                        }
                                }
                                else
@@ -1505,8 +1505,8 @@ void map_info(int y, int x, byte *ap, char *cp)
 
                                /* Multi-hued attr */
                                if (r_ptr->flags2 & RF2_ATTR_ANY)
-                                       (*ap) = randint(15);
-                               else switch (randint(7))
+                                       (*ap) = randint1(15);
+                               else switch (randint1(7))
                                {
                                        case 1:
                                                (*ap) = TERM_RED;
@@ -1620,7 +1620,7 @@ void map_info(int y, int x, byte *ap, char *cp)
                                                case CLASS_CHAOS_WARRIOR:
                                                        do
                                                        {
-                                                               a = randint(15);
+                                                               a = randint1(15);
                                                        }
                                                        while (a == TERM_DARK);
                                                        break;
index cc9eb44..e44d71f 100644 (file)
@@ -23,7 +23,7 @@ bool test_hit_fire(int chance, int ac, int vis)
        int k;
 
        /* Percentile dice */
-       k = rand_int(100);
+       k = randint0(100);
 
        /* Hack -- Instant miss or hit */
        if (k < 10) return (k < 5);
@@ -38,7 +38,7 @@ bool test_hit_fire(int chance, int ac, int vis)
        if (!vis) chance = (chance + 1) / 2;
 
        /* Power competes against armor */
-       if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+       if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
 
        /* Assume hit */
        return (TRUE);
@@ -56,7 +56,7 @@ bool test_hit_norm(int chance, int ac, int vis)
        int k;
 
        /* Percentile dice */
-       k = rand_int(100);
+       k = randint0(100);
 
        /* Hack -- Instant miss or hit */
        if (k < 10) return (k < 5);
@@ -68,7 +68,7 @@ bool test_hit_norm(int chance, int ac, int vis)
        if (!vis) chance = (chance + 1) / 2;
 
        /* Power must defeat armor */
-       if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+       if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
 
        /* Assume hit */
        return (TRUE);
@@ -88,9 +88,9 @@ s16b critical_shot(int weight, int plus, int dam)
        i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2));
 
        /* Critical hit */
-       if (randint(5000) <= i)
+       if (randint1(5000) <= i)
        {
-               k = weight + randint(500);
+               k = weight + randint1(500);
 
                if (k < 500)
                {
@@ -142,10 +142,10 @@ s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
        i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
 
        /* Chance */
-       if ((randint((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
+       if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
        {
-               k = weight + randint(650);
-               if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint(650);
+               k = weight + randint1(650);
+               if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
 
                if (k < 400)
                {
@@ -568,7 +568,7 @@ void search(void)
                for (x = (px - 1); x <= (px + 1); x++)
                {
                        /* Sometimes, notice things */
-                       if (rand_int(100) < chance)
+                       if (randint0(100) < chance)
                        {
                                /* Access the grid */
                                c_ptr = &cave[y][x];
@@ -1582,7 +1582,7 @@ static int check_hit(int power)
        int k, ac;
 
        /* Percentile dice */
-       k = rand_int(100);
+       k = randint0(100);
 
        /* Hack -- 5% hit, 5% miss */
        if (k < 10) return (k < 5);
@@ -1597,7 +1597,7 @@ static int check_hit(int power)
        ac = p_ptr->ac + p_ptr->to_a;
 
        /* Power competes against Armor */
-       if (randint(power) > ((ac * 3) / 4)) return (TRUE);
+       if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
 
        /* Assume miss */
        return (FALSE);
@@ -1741,7 +1741,7 @@ static void hit_trap(bool break_trap)
                                dam = damroll(2, 6);
 
                                /* Extra spike damage */
-                               if (rand_int(100) < 50)
+                               if (randint0(100) < 50)
                                {
 #ifdef JP
                                        msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
@@ -1757,7 +1757,7 @@ static void hit_trap(bool break_trap)
 #endif
 
                                        dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint(dam));
+                                       (void)set_cut(p_ptr->cut + randint1(dam));
                                }
 
                                /* Take the damage */
@@ -1797,7 +1797,7 @@ static void hit_trap(bool break_trap)
 
 
                                /* Extra spike damage */
-                               if (rand_int(100) < 50)
+                               if (randint0(100) < 50)
                                {
 #ifdef JP
                                        msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
@@ -1814,7 +1814,7 @@ static void hit_trap(bool break_trap)
 
 
                                        dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint(dam));
+                                       (void)set_cut(p_ptr->cut + randint1(dam));
 
                                        if (p_ptr->resist_pois || p_ptr->oppose_pois)
                                        {
@@ -1829,7 +1829,7 @@ static void hit_trap(bool break_trap)
                                        else
                                        {
                                                dam = dam * 2;
-                                               (void)set_poisoned(p_ptr->poisoned + randint(dam));
+                                               (void)set_poisoned(p_ptr->poisoned + randint1(dam));
                                        }
                                }
 
@@ -1849,14 +1849,14 @@ static void hit_trap(bool break_trap)
 #endif
 
                        c_ptr->info &= ~(CAVE_MARK);
-                       cave_set_feat(y, x, floor_type[rand_int(100)]);
-                       num = 2 + randint(3);
+                       cave_set_feat(y, x, floor_type[randint0(100)]);
+                       num = 2 + randint1(3);
                        for (i = 0; i < num; i++)
                        {
                                (void)summon_specific(0, y, x, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
                        }
 
-                       if (dun_level > randint(100)) /* No nasty effect for low levels */
+                       if (dun_level > randint1(100)) /* No nasty effect for low levels */
                        {
                                bool stop_ty = FALSE;
                                int count = 0;
@@ -1930,7 +1930,7 @@ static void hit_trap(bool break_trap)
 
                                dam = damroll(1, 4);
                                take_hit(DAMAGE_ATTACK, dam, name, -1);
-                               (void)set_slow(p_ptr->slow + rand_int(20) + 20, FALSE);
+                               (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
                        }
                        else
                        {
@@ -2047,7 +2047,7 @@ static void hit_trap(bool break_trap)
 
                        if (!p_ptr->resist_blind)
                        {
-                               (void)set_blind(p_ptr->blind + rand_int(50) + 25);
+                               (void)set_blind(p_ptr->blind + randint0(50) + 25);
                        }
                        break;
                }
@@ -2062,7 +2062,7 @@ static void hit_trap(bool break_trap)
 
                        if (!p_ptr->resist_conf)
                        {
-                               (void)set_confused(p_ptr->confused + rand_int(20) + 10);
+                               (void)set_confused(p_ptr->confused + randint0(20) + 10);
                        }
                        break;
                }
@@ -2077,7 +2077,7 @@ static void hit_trap(bool break_trap)
 
                        if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
                        {
-                               (void)set_poisoned(p_ptr->poisoned + rand_int(20) + 10);
+                               (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
                        }
                        break;
                }
@@ -2117,7 +2117,7 @@ msg_print("
                                        /* Remove the monster restriction */
                                        get_mon_num_prep(NULL, NULL);
                                }
-                               (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 5);
+                               (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
                        }
                        break;
                }
@@ -2132,7 +2132,7 @@ msg_print("
 
 
                        /* Destroy this trap */
-                       cave_set_feat(y, x, floor_type[rand_int(100)]);
+                       cave_set_feat(y, x, floor_type[randint0(100)]);
 
                        /* Make some new traps */
                        project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
@@ -2142,7 +2142,7 @@ msg_print("
        }
        if (break_trap && is_trap(c_ptr->feat))
        {
-               cave_set_feat(y, x, floor_type[rand_int(100)]);
+               cave_set_feat(y, x, floor_type[randint0(100)]);
 #ifdef JP
                msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
 #else
@@ -2328,7 +2328,7 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
        chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
 
        /* Test for hit */
-       if ((!(r_ptr->flags2 & RF2_QUANTUM) || !rand_int(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
+       if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
        {
                /* Sound */
                sound(SOUND_HIT);
@@ -2458,7 +2458,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                        /* Can't backstab creatures that we can't see, right? */
                        backstab = TRUE;
                }
-               else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (rand_int(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
+               else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
                {
                        fuiuchi = TRUE;
                }
@@ -2615,7 +2615,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                if (one_in_(10))
                                chg_virtue(V_CHANCE, 1);
 
-                               if (randint(5) < 3)
+                               if (randint1(5) < 3)
                                {
                                        /* Vampiric (20%) */
                                        chaos_effect = 1;
@@ -2652,7 +2652,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                        can_drain = FALSE;
                        }
 
-                       if ((f1 & TR1_VORPAL) && (randint((o_ptr->name1 == ART_VORPAL_BLADE) ? 3 : 6) == 1) && !zantetsu_mukou)
+                       if ((f1 & TR1_VORPAL) && (randint1((o_ptr->name1 == ART_VORPAL_BLADE) ? 3 : 6) == 1) && !zantetsu_mukou)
                                vorpal_cut = TRUE;
                        else vorpal_cut = FALSE;
 
@@ -2683,12 +2683,12 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                {
                                        do
                                        {
-                                               ma_ptr = &ma_blows[rand_int(MAX_MA)];
+                                               ma_ptr = &ma_blows[randint0(MAX_MA)];
                                                if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
                                                else min_level = ma_ptr->min_level;
                                        }
                                        while ((min_level > p_ptr->lev) ||
-                                              (randint(p_ptr->lev) < ma_ptr->chance));
+                                              (randint1(p_ptr->lev) < ma_ptr->chance));
 
                                        /* keep the highest level attack available we found */
                                        if ((ma_ptr->min_level > old_ptr->min_level) &&
@@ -2753,13 +2753,13 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                {
                                        if (ma_ptr->effect)
                                        {
-                                               stun_effect = (ma_ptr->effect / 2) + randint(ma_ptr->effect / 2);
+                                               stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
                                        }
 
                                        msg_format(ma_ptr->desc, m_name);
                                }
 
-                               k = critical_norm(p_ptr->lev * randint((p_ptr->special_defense & KAMAE_SUZAKU) ? 5 : 10), min_level, k, p_ptr->to_h[0], 0);
+                               k = critical_norm(p_ptr->lev * randint1((p_ptr->special_defense & KAMAE_SUZAKU) ? 5 : 10), min_level, k, p_ptr->to_h[0], 0);
 
                                if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
                                {
@@ -2769,14 +2769,14 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                        msg_format("%^s moans in agony!", m_name);
 #endif
 
-                                       stun_effect = 7 + randint(13);
+                                       stun_effect = 7 + randint1(13);
                                        resist_stun /= 3;
                                }
 
                                else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
                                {
                                        if (!(r_ptr->flags1 & RF1_UNIQUE) &&
-                                           (randint(p_ptr->lev) > r_ptr->level) &&
+                                           (randint1(p_ptr->lev) > r_ptr->level) &&
                                            m_ptr->mspeed > 60)
                                        {
 #ifdef JP
@@ -2791,7 +2791,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
 
                                if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
                                {
-                                       if (p_ptr->lev > randint(r_ptr->level + resist_stun + 10))
+                                       if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
                                        {
                                                if (m_ptr->stunned)
 #ifdef JP
@@ -3001,7 +3001,7 @@ default:  msg_format("%s
 
                        if (mode == HISSATSU_MINEUCHI)
                        {
-                               int tmp = (10 + randint(15) + p_ptr->lev / 5);
+                               int tmp = (10 + randint1(15) + p_ptr->lev / 5);
 
                                k = 0;
                                anger_monster(m_ptr);
@@ -3045,7 +3045,7 @@ msg_format("%s 
                        k = mon_damage_mod(m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
                        if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
                        {
-                               if ((randint(randint(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
+                               if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
                                {
                                        k = m_ptr->hp + 1;
 #ifdef JP
@@ -3260,7 +3260,7 @@ msg_format("
 #endif
 
                                }
-                               else if (rand_int(100) < r_ptr->level)
+                               else if (randint0(100) < r_ptr->level)
                                {
 #ifdef JP
                                        msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
@@ -3277,7 +3277,7 @@ msg_format("
                                        msg_format("%^s appears confused.", m_name);
 #endif
 
-                                       m_ptr->confused += 10 + rand_int(p_ptr->lev) / 5;
+                                       m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
                                }
                        }
 
@@ -3298,7 +3298,7 @@ msg_format("
 
                                                resists_tele = TRUE;
                                        }
-                                       else if (r_ptr->level > randint(100))
+                                       else if (r_ptr->level > randint1(100))
                                        {
                                                if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -3326,7 +3326,7 @@ msg_format("
                        }
 
                        else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
-                                (randint(90) > r_ptr->level))
+                                (randint1(90) > r_ptr->level))
                        {
                                if (!(r_ptr->flags1 & RF1_UNIQUE) &&
                                    !(r_ptr->flags4 & RF4_BR_CHAO) &&
@@ -4125,7 +4125,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        if (m_ptr->ml) health_track(c_ptr->m_idx);
 
                        /* displace? */
-                       if ((stormbringer && (randint(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
+                       if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
                        {
                                py_attack(y, x, 0);
                                oktomove = FALSE;
@@ -4531,7 +4531,7 @@ msg_format("%s
                                cave[py][px].info &= ~(CAVE_MARK);
 
                                /* Notice */
-                               cave_set_feat(py, px, floor_type[rand_int(100)]);
+                               cave_set_feat(py, px, floor_type[randint0(100)]);
                        }
                }
                if (music_singing(MUSIC_WALL))
@@ -4551,7 +4551,7 @@ msg_format("%s
                                        cave_set_feat(py, px, FEAT_GRASS);
                                else
                                {
-                                       cave[py][px].feat = floor_type[rand_int(100)];
+                                       cave[py][px].feat = floor_type[randint0(100)];
                                        cave[py][px].info &= ~(CAVE_MASK);
                                        cave[py][px].info |= CAVE_FLOOR;
                                }
@@ -4604,7 +4604,7 @@ msg_format("%s
 
                /* Spontaneous Searching */
                if ((p_ptr->skill_fos >= 50) ||
-                   (0 == rand_int(50 - p_ptr->skill_fos)))
+                   (0 == randint0(50 - p_ptr->skill_fos)))
                {
                        search();
                }
index 67801ed..f48c8a5 100644 (file)
@@ -559,7 +559,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
                object_wipe(q_ptr);
 
                /* Small chests often drop gold */
-               if (small && (rand_int(100) < 25))
+               if (small && (randint0(100) < 25))
                {
                        /* Make some gold */
                        if (!make_gold(q_ptr)) continue;
@@ -579,8 +579,8 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
                        for (i = 0; i < 200; i++)
                        {
                                /* Pick a totally random spot. */
-                               y = rand_int(MAX_HGT);
-                               x = rand_int(MAX_WID);
+                               y = randint0(MAX_HGT);
+                               x = randint0(MAX_WID);
 
                                /* Must be an empty floor. */
                                if (!cave_empty_bold(y, x)) continue;
@@ -669,7 +669,7 @@ static void chest_trap(int y, int x, s16b o_idx)
 
                if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
                {
-                       (void)set_poisoned(p_ptr->poisoned + 10 + randint(20));
+                       (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
                }
        }
 
@@ -685,14 +685,14 @@ static void chest_trap(int y, int x, s16b o_idx)
 
                if (!p_ptr->free_act)
                {
-                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint(20));
+                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
                }
        }
 
        /* Summon monsters */
        if (trap & (CHEST_SUMMON))
        {
-               int num = 2 + randint(3);
+               int num = 2 + randint1(3);
 #ifdef JP
                msg_print("ÆÍÇ¡¿á¤­½Ð¤·¤¿±ì¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
 #else
@@ -702,7 +702,7 @@ static void chest_trap(int y, int x, s16b o_idx)
 
                for (i = 0; i < num; i++)
                {
-                       if (randint(100)<dun_level)
+                       if (randint1(100)<dun_level)
                                activate_hi_summon(py, px, FALSE);
                        else
                                (void)summon_specific(0, y, x, mon_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
@@ -717,7 +717,7 @@ static void chest_trap(int y, int x, s16b o_idx)
 #else
                msg_print("Elemental beings appear to protect their treasures!");
 #endif
-               for (i = 0; i < randint(3) + 5; i++)
+               for (i = 0; i < randint1(3) + 5; i++)
                {
                        (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, TRUE, FALSE, FALSE, TRUE, TRUE);
                }
@@ -732,10 +732,10 @@ static void chest_trap(int y, int x, s16b o_idx)
                msg_print("A storm of birds swirls around you!");
 #endif
 
-               for (i = 0; i < randint(3) + 3; i++)
+               for (i = 0; i < randint1(3) + 3; i++)
                        (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
 
-               for (i = 0; i < randint(5) + o_ptr->pval / 5; i++)
+               for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
                {
                        (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, TRUE, FALSE, FALSE, TRUE, TRUE);
                }
@@ -753,7 +753,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                        msg_print("Demons materialize in clouds of fire and brimstone!");
 #endif
 
-                       for (i = 0; i < randint(3) + 2; i++)
+                       for (i = 0; i < randint1(3) + 2; i++)
                        {
                                (void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);
                                (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, TRUE, FALSE, FALSE, TRUE, TRUE);
@@ -769,7 +769,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                        msg_print("Draconic forms loom out of the darkness!");
 #endif
 
-                       for (i = 0; i < randint(3) + 2; i++)
+                       for (i = 0; i < randint1(3) + 2; i++)
                        {
                                (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, TRUE, FALSE, FALSE, TRUE, TRUE);
                        }
@@ -784,7 +784,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                        msg_print("Creatures strange and twisted assault you!");
 #endif
 
-                       for (i = 0; i < randint(5) + 3; i++)
+                       for (i = 0; i < randint1(5) + 3; i++)
                        {
                                (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, TRUE, FALSE, FALSE, TRUE, TRUE);
                        }
@@ -799,7 +799,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                        msg_print("Vortices coalesce and wreak destruction!");
 #endif
 
-                       for (i = 0; i < randint(3) + 2; i++)
+                       for (i = 0; i < randint1(3) + 2; i++)
                        {
                                (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, TRUE, FALSE, FALSE, TRUE, TRUE);
                        }
@@ -810,7 +810,7 @@ static void chest_trap(int y, int x, s16b o_idx)
        if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
        {
                /* Determine how many nasty tricks can be played. */
-               int nasty_tricks_count = 4 + rand_int(3);
+               int nasty_tricks_count = 4 + randint0(3);
 
                /* Message. */
 #ifdef JP
@@ -823,7 +823,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                for (; nasty_tricks_count > 0; nasty_tricks_count--)
                {
                        /* ...but a high saving throw does help a little. */
-                       if (randint(100+o_ptr->pval*2) > p_ptr->skill_sav)
+                       if (randint1(100+o_ptr->pval*2) > p_ptr->skill_sav)
                        {
 #ifdef JP
                                if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
@@ -835,10 +835,10 @@ static void chest_trap(int y, int x, s16b o_idx)
                                {
                                        if (!p_ptr->free_act) 
                                                (void)set_paralyzed(p_ptr->paralyzed + 2 + 
-                                               rand_int(6));
+                                               randint0(6));
                                        else 
                                                (void)set_stun(p_ptr->stun + 10 + 
-                                               rand_int(100));
+                                               randint0(100));
                                }
                                else if (one_in_(3)) apply_disenchant(0);
                                else if (one_in_(2))
@@ -930,7 +930,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                if (j < 2) j = 2;
 
                /* Success -- May still have traps */
-               if (rand_int(100) < j)
+               if (randint0(100) < j)
                {
 #ifdef JP
                        msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
@@ -1149,7 +1149,7 @@ static bool do_cmd_open_aux(int y, int x, int dir)
                if (j < 2) j = 2;
 
                /* Success */
-               if (rand_int(100) < j)
+               if (randint0(100) < j)
                {
                        /* Message */
 #ifdef JP
@@ -1609,7 +1609,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
        else if (c_ptr->feat == FEAT_TREES) /* -KMW- */
        {
                /* Chop Down */
-               if ((p_ptr->skill_dig > 10 + rand_int(400)) && twall(y, x, FEAT_GRASS))
+               if ((p_ptr->skill_dig > 10 + randint0(400)) && twall(y, x, FEAT_GRASS))
                {
 #ifdef JP
                        msg_print("ÌÚ¤òÀÚ¤êʧ¤Ã¤¿¡£");
@@ -1633,7 +1633,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
                        more = TRUE;
 
                        /* Occasional Search XXX XXX */
-                       if (rand_int(100) < 25) search();
+                       if (randint0(100) < 25) search();
                }
        }
 
@@ -1643,7 +1643,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
                 (c_ptr->feat <= FEAT_WALL_SOLID))
        {
                /* Tunnel */
-               if ((p_ptr->skill_dig > 40 + rand_int(1600)) && twall(y, x, floor_type[rand_int(100)]))
+               if ((p_ptr->skill_dig > 40 + randint0(1600)) && twall(y, x, floor_type[randint0(100)]))
                {
 #ifdef JP
                        msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
@@ -1686,17 +1686,17 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
                /* Quartz */
                if (hard)
                {
-                       okay = (p_ptr->skill_dig > 20 + rand_int(800));
+                       okay = (p_ptr->skill_dig > 20 + randint0(800));
                }
 
                /* Magma */
                else
                {
-                       okay = (p_ptr->skill_dig > 10 + rand_int(400));
+                       okay = (p_ptr->skill_dig > 10 + randint0(400));
                }
 
                /* Success */
-               if (okay && twall(y, x, floor_type[rand_int(100)]))
+               if (okay && twall(y, x, floor_type[randint0(100)]))
                {
                        /* Found treasure */
                        if (gold)
@@ -1758,7 +1758,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
        else if (c_ptr->feat == FEAT_RUBBLE)
        {
                /* Remove the rubble */
-               if ((p_ptr->skill_dig > rand_int(200)) && twall(y, x, floor_type[rand_int(100)]))
+               if ((p_ptr->skill_dig > randint0(200)) && twall(y, x, floor_type[randint0(100)]))
                {
                        /* Message */
 #ifdef JP
@@ -1768,7 +1768,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
 #endif
 
                        /* Hack -- place an object */
-                       if (rand_int(100) < (15 - dun_level/2))
+                       if (randint0(100) < (15 - dun_level/2))
                        {
                                /* Create a simple object */
                                place_object(y, x, FALSE, FALSE);
@@ -1803,7 +1803,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
        else if (c_ptr->feat >= FEAT_SECRET)
        {
                /* Tunnel */
-               if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x, floor_type[rand_int(100)]))
+               if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint0(100)]))
                {
 #ifdef JP
                        msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
@@ -1826,7 +1826,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
                        more = TRUE;
 
                        /* Occasional Search XXX XXX */
-                       if (rand_int(100) < 25) search();
+                       if (randint0(100) < 25) search();
                }
        }
 
@@ -1834,7 +1834,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir)
        else
        {
                /* Tunnel */
-               if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x, floor_type[randint(100)]))
+               if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint1(100)]))
                {
 #ifdef JP
                        msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
@@ -2044,7 +2044,7 @@ bool easy_open_door(int y, int x)
                if (j < 2) j = 2;
 
                /* Success */
-               if (rand_int(100) < j)
+               if (randint0(100) < j)
                {
                        /* Message */
 #ifdef JP
@@ -2171,7 +2171,7 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
        }
 
        /* Success (get a lot of experience) */
-       else if (rand_int(100) < j)
+       else if (randint0(100) < j)
        {
 #ifdef JP
                msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¥È¥é¥Ã¥×¤ò²ò½ü¤·¤¿¡£");
@@ -2184,7 +2184,7 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
        }
 
        /* Failure -- Keep trying */
-       else if ((i > 5) && (randint(i) > 5))
+       else if ((i > 5) && (randint1(i) > 5))
        {
                /* We may keep trying */
                more = TRUE;
@@ -2271,7 +2271,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        if (j < 2) j = 2;
 
        /* Success */
-       if (rand_int(100) < j)
+       if (randint0(100) < j)
        {
                /* Message */
 #ifdef JP
@@ -2288,7 +2288,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                c_ptr->info &= ~(CAVE_MARK);
 
                /* Remove the trap */
-               c_ptr->feat = floor_type[rand_int(100)];
+               c_ptr->feat = floor_type[randint0(100)];
                c_ptr->info &= ~(CAVE_MASK);
                c_ptr->info |= CAVE_FLOOR;
                note_spot(y, x);
@@ -2308,7 +2308,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        }
 
        /* Failure -- Keep trying */
-       else if ((i > 5) && (randint(i) > 5))
+       else if ((i > 5) && (randint1(i) > 5))
        {
                /* Failure */
                if (flush_failure) flush();
@@ -2517,7 +2517,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        if (temp < 1) temp = 1;
 
        /* Hack -- attempt to bash down the door */
-       if (rand_int(100) < temp)
+       if (randint0(100) < temp)
        {
                /* Message */
 #ifdef JP
@@ -2528,7 +2528,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
 
 
                /* Break down the door */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                {
                        cave_set_feat(y, x, FEAT_BROKEN);
                }
@@ -2551,7 +2551,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        }
 
        /* Saving throw against stun */
-       else if (rand_int(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+       else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                 p_ptr->lev)
        {
                /* Message */
@@ -2578,7 +2578,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
 
 
                /* Hack -- Lose balance ala paralysis */
-               (void)set_paralyzed(p_ptr->paralyzed + 2 + rand_int(2));
+               (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
        }
 
        /* Result */
@@ -2981,7 +2981,7 @@ void do_cmd_walk(int pickup)
                int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
                if (tmp < 1) 
                        tmp = 1;
-               if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && rand_int(tmp) < (21-p_ptr->skill_stl))
+               if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
                {
                        /* Inform the player of his horrible fate :=) */
 #ifdef JP
@@ -2993,8 +2993,8 @@ void do_cmd_walk(int pickup)
                        /* Go into large wilderness view */
                        p_ptr->wilderness_x = px;
                        p_ptr->wilderness_y = py;
-                       p_ptr->oldpy = randint(MAX_HGT-2);
-                       p_ptr->oldpx = randint(MAX_WID-2);
+                       p_ptr->oldpy = randint1(MAX_HGT-2);
+                       p_ptr->oldpx = randint1(MAX_WID-2);
                        energy_use = 100;
                        change_wild_mode();
 
@@ -3074,7 +3074,7 @@ void do_cmd_stay(int pickup)
 
 
        /* Spontaneous Searching */
-       if ((p_ptr->skill_fos >= 50) || (0 == rand_int(50 - p_ptr->skill_fos)))
+       if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
        {
                search();
        }
@@ -4218,8 +4218,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        if (shuriken)
        {
-               ty = rand_int(101)-50+py;
-               tx = rand_int(101)-50+px;
+               ty = randint0(101)-50+py;
+               tx = randint0(101)-50+px;
        }
        else
        {
@@ -4547,7 +4547,7 @@ msg_print("
        /* Potions smash open */
        if (object_is_potion(q_ptr))
        {
-               if (hit_body || hit_wall || (randint(100) < j))
+               if (hit_body || hit_wall || (randint1(100) < j))
                {
                        /* Message */
 #ifdef JP
@@ -4587,12 +4587,12 @@ msg_print("
 
        if (return_when_thrown)
        {
-               int back_chance = randint(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
+               int back_chance = randint1(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
                char o2_name[MAX_NLEN];
                bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
 
                j = -1;
-               if (boomerang) back_chance += 4+randint(5);
+               if (boomerang) back_chance += 4+randint1(5);
                if (super_boomerang) back_chance += 100;
                object_desc(o2_name, q_ptr, FALSE, 0);
 
index 22f6409..90810b2 100644 (file)
@@ -774,10 +774,10 @@ static void do_cmd_disp_nikki(void)
        path_build(buf, 1024, ANGBAND_DIR_USER, file_name);
 
        if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
-               strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-1)]);
+               strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
        else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
-               strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-1)+1]);
-       else strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-2)+1]);
+               strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
+       else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
 
 #ifdef JP
        sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
@@ -7549,7 +7549,7 @@ msg_format("%d 
                                  min, (hour < 12) ? "AM" : "PM");
 
        /* Find the path */
-       if (!rand_int(10) || p_ptr->image)
+       if (!randint0(10) || p_ptr->image)
                {
 #ifdef JP
                path_build(buf, 1024, ANGBAND_DIR_FILE, "timefun_j.txt");
@@ -7615,7 +7615,7 @@ msg_format("%d 
                        num++;
 
                        /* Apply the randomizer */
-                       if (!rand_int(num)) strcpy(desc, buf + 2);
+                       if (!randint0(num)) strcpy(desc, buf + 2);
 
                        /* Next... */
                        continue;
index ad39f75..c4fe21c 100644 (file)
@@ -939,12 +939,12 @@ msg_format("
 void wild_magic(int spell)
 {
        int counter = 0;
-       int type = SUMMON_BIZARRE1 + rand_int(6);
+       int type = SUMMON_BIZARRE1 + randint0(6);
 
        if (type < SUMMON_BIZARRE1) type = SUMMON_BIZARRE1;
        else if (type > SUMMON_BIZARRE6) type = SUMMON_BIZARRE6;
 
-       switch (randint(spell) + randint(8) + 1)
+       switch (randint1(spell) + randint1(8) + 1)
        {
        case 1:
        case 2:
@@ -1052,7 +1052,7 @@ static bool cast_life_spell(int spell)
                (void)set_cut(p_ptr->cut - 10);
                break;
        case 2: /* Bless */
-               (void)set_blessed(randint(12) + 12, FALSE);
+               (void)set_blessed(randint1(12) + 12, FALSE);
                break;
        case 3: /* Remove Fear */
                (void)set_afraid(0);
@@ -1091,7 +1091,7 @@ static bool cast_life_spell(int spell)
                (void)set_cut(0);
                break;
        case 11: /* Sense Unseen */
-               (void)set_tim_invis(randint(24) + 24, FALSE);
+               (void)set_tim_invis(randint1(24) + 24, FALSE);
                break;
        case 12: /* Holy Orb */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -1105,7 +1105,7 @@ static bool cast_life_spell(int spell)
 
                break;
        case 13: /* Protection from Evil */
-               (void)set_protevil(randint(25) + 3 * p_ptr->lev, FALSE);
+               (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
                break;
        case 14: /* Healing */
                (void)hp_player(300);
@@ -1116,8 +1116,8 @@ static bool cast_life_spell(int spell)
                warding_glyph();
                break;
        case 16: /* Exorcism */
-               (void)dispel_undead(randint(plev));
-               (void)dispel_demons(randint(plev));
+               (void)dispel_undead(randint1(plev));
+               (void)dispel_demons(randint1(plev));
                (void)turn_evil(plev);
                break;
        case 17: /* Dispel Curse */
@@ -1131,14 +1131,14 @@ static bool cast_life_spell(int spell)
                }
                break;
        case 18: /* Dispel Undead + Demons */
-               (void)dispel_undead(randint(plev * 3));
-               (void)dispel_demons(randint(plev * 3));
+               (void)dispel_undead(randint1(plev * 3));
+               (void)dispel_demons(randint1(plev * 3));
                break;
        case 19: /* 'Day of the Dove' */
                charm_monsters(plev * 2);
                break;
        case 20: /* Dispel Evil */
-               (void)dispel_evil(randint(plev * 4));
+               (void)dispel_evil(randint1(plev * 4));
                break;
        case 21: /* Banishment */
                if (banish_evil(100))
@@ -1152,7 +1152,7 @@ msg_print("
                }
                break;
        case 22: /* Holy Word */
-               (void)dispel_evil(randint(plev * 4));
+               (void)dispel_evil(randint1(plev * 4));
                (void)hp_player(1000);
                (void)set_afraid(0);
                (void)set_poisoned(0);
@@ -1164,12 +1164,12 @@ msg_print("
                glyph_creation();
                break;
        case 24: /* Heroism */
-               (void)set_hero(randint(25) + 25, FALSE);
+               (void)set_hero(randint1(25) + 25, FALSE);
                (void)hp_player(10);
                (void)set_afraid(0);
                break;
        case 25: /* Prayer */
-               (void)set_blessed(randint(48) + 48, FALSE);
+               (void)set_blessed(randint1(48) + 48, FALSE);
                break;
        case 26: /* Turn Undead */
                (void)mass_genocide_undead(plev+50,TRUE);
@@ -1199,14 +1199,14 @@ msg_print("
                turn_monsters(plev * 4);
                stasis_monsters(plev * 4);
                summon_specific(-1, py, px, plev, SUMMON_ANGEL, TRUE, TRUE, TRUE, FALSE, FALSE);
-               (void)set_hero(randint(25) + 25, FALSE);
+               (void)set_hero(randint1(25) + 25, FALSE);
                (void)hp_player(300);
-               (void)set_fast(randint(20 + plev) + plev, FALSE);
+               (void)set_fast(randint1(20 + plev) + plev, FALSE);
                (void)set_afraid(0);
                break;
        case 31: /* Ultimate resistance */
        {
-               int v = randint(plev/2)+plev/2;
+               int v = randint1(plev/2)+plev/2;
                (void)set_fast(v, FALSE);
                set_oppose_acid(v, FALSE);
                set_oppose_elec(v, FALSE);
@@ -1286,7 +1286,7 @@ static bool cast_sorcery_spell(int spell)
                (void)fire_beam(GF_AWAY_ALL, dir, plev);
                break;
        case 13: /* Haste Self */
-               (void)set_fast(randint(20 + plev) + plev, FALSE);
+               (void)set_fast(randint1(20 + plev) + plev, FALSE);
                break;
        case 14: /* Detection True */
                (void)detect_all(DETECT_RAD_DEFAULT);
@@ -1304,7 +1304,7 @@ static bool cast_sorcery_spell(int spell)
                (void)charm_monster(dir, plev);
                break;
        case 18: /* Sense Minds */
-               (void)set_tim_esp(randint(30) + 25, FALSE);
+               (void)set_tim_esp(randint1(30) + 25, FALSE);
                break;
        case 19: /* Teleport to town */
                return tele_town();
@@ -1349,7 +1349,7 @@ msg_print("
                wiz_lite(FALSE, FALSE);
                if (!(p_ptr->telepathy))
                {
-                       (void)set_tim_esp(randint(30) + 25, FALSE);
+                       (void)set_tim_esp(randint1(30) + 25, FALSE);
                }
                break;
        case 28: /* Charm Monsters */
@@ -1361,7 +1361,7 @@ msg_print("
                banish_monsters(plev * 4);
                break;
        case 31: /* Globe of Invulnerability */
-               (void)set_invuln(randint(4) + 4, FALSE);
+               (void)set_invuln(randint1(4) + 4, FALSE);
                break;
        default:
 #ifdef JP
@@ -1432,9 +1432,9 @@ take_hit(DAMAGE_NOESCAPE, damroll(2, 2), "
                (void)charm_animal(dir, plev);
                break;
        case 6: /* Resist Environment */
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
                break;
        case 7: /* Cure Wounds & Poison */
                (void)hp_player(damroll(2, 8));
@@ -1490,14 +1490,14 @@ msg_print("
                (void)stair_creation();
                break;
        case 17: /* Stone Skin */
-               (void)set_shield(randint(20) + 30, FALSE);
+               (void)set_shield(randint1(20) + 30, FALSE);
                break;
        case 18: /* Resistance True */
-               (void)set_oppose_acid(randint(20) + 20, FALSE);
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
-               (void)set_oppose_pois(randint(20) + 20, FALSE);
+               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               (void)set_oppose_pois(randint1(20) + 20, FALSE);
                break;
        case 19: /* Tree Creation */
                (void)tree_creation();
@@ -1571,7 +1571,7 @@ take_hit(DAMAGE_NOESCAPE, 50, "
                }
                break;
        case 30: /* Elemental Branding */
-               brand_weapon(rand_int(2));
+               brand_weapon(randint0(2));
                break;
        case 31: /* Nature's Wrath */
                (void)dispel_monsters(plev * 4);
@@ -1673,17 +1673,17 @@ msg_print("
                keeping the results quite random.  It also allows
                        some potent effects only at high level. */
 
-                       int die = randint(100) + plev / 5;
+                       int die = randint1(100) + plev / 5;
                        int vir = virtue_number(V_CHANCE);
                        if (vir)
                        {
                                if (p_ptr->virtues[vir - 1] > 0)
                                {
-                                       while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+                                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
                                }
                                else
                                {
-                                       while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+                                       while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
                                }
                        }
 
@@ -1732,7 +1732,7 @@ msg_print("
                        }
                        else if (die < 106)
                        {
-                               destroy_area(py, px, 13+rand_int(5), TRUE);
+                               destroy_area(py, px, 13+randint0(5), TRUE);
                        }
                        else if (die < 108)
                        {
@@ -1781,7 +1781,7 @@ msg_print("
                (void)fire_beam(GF_AWAY_ALL, dir, plev);
                break;
        case 14: /* Word of Destruction */
-               destroy_area(py, px, 13+rand_int(5), TRUE);
+               destroy_area(py, px, 13+randint0(5), TRUE);
                break;
        case 15: /* Invoke Logrus */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -1860,7 +1860,7 @@ msg_print("
        case 25: /* Meteor Swarm  */
                {
                        int x, y, dx, dy;
-                       int b = 10 + randint(10);
+                       int b = 10 + randint1(10);
                        for (i = 0; i < b; i++)
                        {
                                int count = 0, d = 0;
@@ -1869,8 +1869,8 @@ msg_print("
                                {
                                        count++;
                                        if (count > 20) break;
-                                       x = px - 8 + rand_int(17);
-                                       y = py - 8 + rand_int(17);
+                                       x = px - 8 + randint0(17);
+                                       y = py - 8 + randint0(17);
 
                                        if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
 
@@ -1957,7 +1957,7 @@ static bool cast_death_spell(int spell)
 
                if (one_in_(5))
                {   /* Special effect first */
-                       dummy = randint(1000);
+                       dummy = randint1(1000);
                        if (dummy == 666)
                                fire_ball_hide(GF_DEATH_RAY, dir, plev * 200, 0);
                        else if (dummy < 500)
@@ -1982,7 +1982,7 @@ static bool cast_death_spell(int spell)
                (void)sleep_monster(dir);
                break;
        case 5: /* Resist Poison */
-               (void)set_oppose_pois(randint(20) + 20, FALSE);
+               (void)set_oppose_pois(randint1(20) + 20, FALSE);
                break;
        case 6: /* Horrify */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -2026,7 +2026,7 @@ static bool cast_death_spell(int spell)
        case 13: /* Vampiric Drain */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               dummy = plev * 2 + randint(plev * 2);   /* Dmg */
+               dummy = plev * 2 + randint1(plev * 2);   /* Dmg */
                if (drain_life(dir, dummy))
                {
                        chg_virtue(V_SACRIFICE, -1);
@@ -2049,23 +2049,23 @@ static bool cast_death_spell(int spell)
                (void)symbol_genocide(plev+50, TRUE);
                break;
        case 16: /* Berserk */
-               (void)set_shero(randint(25) + 25, FALSE);
+               (void)set_shero(randint1(25) + 25, FALSE);
                (void)hp_player(30);
                (void)set_afraid(0);
                break;
        case 17: /* Invoke Spirits */
                {
-                       int die = randint(100) + plev / 5;
+                       int die = randint1(100) + plev / 5;
                        int vir = virtue_number(V_CHANCE);
                        if (vir)
                        {
                                if (p_ptr->virtues[vir - 1] > 0)
                                {
-                                       while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+                                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
                                }
                                else
                                {
-                                       while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+                                       while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
                                }
                        }
 
@@ -2106,7 +2106,7 @@ msg_print("̾
                                msg_print("An unnamable evil brushes against your mind...");
 #endif
 
-                               set_afraid(p_ptr->afraid + randint(4) + 4);
+                               set_afraid(p_ptr->afraid + randint1(4) + 4);
                        }
                        else if (die < 26)
                        {
@@ -2116,7 +2116,7 @@ msg_print("
                                msg_print("Your head is invaded by a horde of gibbering spectral voices...");
 #endif
 
-                               set_confused(p_ptr->confused + randint(4) + 4);
+                               set_confused(p_ptr->confused + randint1(4) + 4);
                        }
                        else if (die < 31)
                        {
@@ -2189,7 +2189,7 @@ msg_print("
                        }
                        else if (die < 106)
                        {
-                               destroy_area(py, px, 13+rand_int(5), TRUE);
+                               destroy_area(py, px, 13+randint0(5), TRUE);
                        }
                        else if (die < 108)
                        {
@@ -2223,10 +2223,10 @@ msg_print("
                        damroll(4 + ((plev - 5) / 4), 8));
                break;
        case 19: /* Battle Frenzy */
-               (void)set_shero(randint(25) + 25, FALSE);
+               (void)set_shero(randint1(25) + 25, FALSE);
                (void)hp_player(30);
                (void)set_afraid(0);
-               (void)set_fast(randint(20 + (plev / 2)) + (plev / 2), FALSE);
+               (void)set_fast(randint1(20 + (plev / 2)) + (plev / 2), FALSE);
                break;
        case 20: /* Vampiric Branding */
                brand_weapon(4);
@@ -2244,7 +2244,7 @@ msg_print("
                }
                break;
        case 22: /* Word of Death */
-               (void)dispel_living(randint(plev * 3));
+               (void)dispel_living(randint1(plev * 3));
                break;
        case 23: /* Darkness Storm */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -2301,13 +2301,13 @@ msg_print("
                        break;
                }
        case 26: /* Esoteria */
-               if (randint(50) > plev)
+               if (randint1(50) > plev)
                        return ident_spell(FALSE);
                else
                        return identify_fully(FALSE);
                break;
        case 27: /* Mimic vampire */
-               (void)set_mimic(10+plev/2 + randint(10+plev/2), MIMIC_VAMPIRE, FALSE);
+               (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_VAMPIRE, FALSE);
                break;
        case 28: /* Restore Life */
                (void)restore_level();
@@ -2320,14 +2320,14 @@ msg_print("
 
                fire_ball(GF_HELL_FIRE, dir, 666, 3);
 #ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint(30), "ÃϹö¤Î¹å²Ð¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_USELIFE, 20 + randint1(30), "ÃϹö¤Î¹å²Ð¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-               take_hit(DAMAGE_USELIFE, 20 + randint(30), "the strain of casting Hellfire", -1);
+               take_hit(DAMAGE_USELIFE, 20 + randint1(30), "the strain of casting Hellfire", -1);
 #endif
 
                break;
        case 31: /* Wraithform */
-               set_wraith_form(randint(plev / 2) + (plev / 2), FALSE);
+               set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
                break;
        default:
                msg_format("You cast an unknown Death spell: %d.", spell);
@@ -2343,7 +2343,7 @@ static bool cast_trump_spell(int spell, bool success)
        int     dir;
        int     beam;
        int     plev = p_ptr->lev;
-       int     summon_lev = plev * 2 / 3 + randint(plev/2);
+       int     summon_lev = plev * 2 / 3 + randint1(plev/2);
        int     dummy = 0;
        bool    no_trump = FALSE;
        bool    unique_okay = FALSE;
@@ -2354,7 +2354,7 @@ static bool cast_trump_spell(int spell, bool success)
        else beam = plev / 2;
 
        if (summon_lev < 1) summon_lev = 1;
-       if (!success || (randint(50+plev) < plev/10)) unique_okay = TRUE;
+       if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
        switch (spell)
        {
                case 0: /* Phase Door */
@@ -2365,7 +2365,7 @@ static bool cast_trump_spell(int spell, bool success)
                        break;
                case 1: /* Trump Spiders */
                {
-                       bool pet = success; /* (randint(5) > 2) */
+                       bool pet = success; /* (randint1(5) > 2) */
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤ÏÃØéá¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -2395,24 +2395,24 @@ msg_print("
                        if (success)
                        {
                                /* A limited power 'wonder' spell */
-                               int die = randint(120);
+                               int die = randint1(120);
                                int vir = virtue_number(V_CHANCE);
 
                                if ((p_ptr->pclass == CLASS_ROGUE) ||
                                        (p_ptr->pclass == CLASS_HIGH_MAGE) ||
                                        (p_ptr->pclass == CLASS_SORCERER))
-                                       die = (randint(110)) + plev / 5;
+                                       die = (randint1(110)) + plev / 5;
                                /* Card sharks and high mages get a level bonus */
 
                                if (vir)
                                {
                                        if (p_ptr->virtues[vir - 1] > 0)
                                        {
-                                               while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+                                               while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
                                        }
                                        else
                                        {
-                                               while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+                                               while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
                                        }
                                }
 
@@ -2433,7 +2433,7 @@ msg_print("
                                        msg_print("Oh no! It's Death!");
 #endif
 
-                                       for (dummy = 0; dummy < randint(3); dummy++)
+                                       for (dummy = 0; dummy < randint1(3); dummy++)
                                                (void)activate_hi_summon(py, px, FALSE);
                                }
                                else if (die < 14)
@@ -2486,7 +2486,7 @@ msg_print("
                                        msg_print("It's the picture of a strange monster.");
 #endif
 
-                                       if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint(6), TRUE, FALSE, FALSE, TRUE, TRUE)))
+                                       if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint1(6), TRUE, FALSE, FALSE, TRUE, TRUE)))
                                                no_trump = TRUE;
                                }
                                else if (die < 33)
@@ -2507,7 +2507,7 @@ msg_print("
                                        msg_print("It's the Wheel of Fortune.");
 #endif
 
-                                       wild_magic(rand_int(32));
+                                       wild_magic(randint0(32));
                                }
                                else if (die < 40)
                                {
@@ -2716,7 +2716,7 @@ msg_print("
                case 5: /* Trump Spying */
                        if (success)
                        {
-                               (void)set_tim_esp(randint(30) + 25, FALSE);
+                               (void)set_tim_esp(randint1(30) + 25, FALSE);
                        }
                        break;
                case 6: /* Teleport Away */
@@ -2728,7 +2728,7 @@ msg_print("
                        break;
                case 7: /* Trump Animals */
                {
-                       bool pet = success; /* was (randint(5) > 2) */
+                       bool pet = success; /* was (randint1(5) > 2) */
                        int type = (pet ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
                        bool group = (pet ? FALSE : TRUE);
 
@@ -2781,9 +2781,9 @@ msg_print("
 #endif
 
 
-                       for (dummy = 2 + rand_int(plev / 7); dummy > 0; dummy--)
+                       for (dummy = 2 + randint0(plev / 7); dummy > 0; dummy--)
                        {
-                               bool pet = success; /* was (randint(10) > 3) */
+                               bool pet = success; /* was (randint1(10) > 3) */
                                bool group = (pet ? FALSE : TRUE);
                                int type;
 
@@ -2895,7 +2895,7 @@ msg_print("
                }
                case 17: /* Trump Undead */
                {
-                       bool pet = success; /* (randint(10) > 3) */
+                       bool pet = success; /* (randint1(10) > 3) */
                        bool group = (pet ? FALSE : TRUE);
 
 #ifdef JP
@@ -2924,7 +2924,7 @@ msg_print("
                }
                case 18: /* Trump Reptiles */
                {
-                       bool pet = success; /* was (randint(5) > 2) */
+                       bool pet = success; /* was (randint1(5) > 2) */
                        bool group = !pet;
 
 #ifdef JP
@@ -2964,7 +2964,7 @@ msg_print("
 
                        for (dummy = 0; dummy < 1 + ((plev - 15)/ 10); dummy++)
                        {
-                               bool pet = success; /* was (randint(10) > 3) */
+                               bool pet = success; /* was (randint1(10) > 3) */
                                bool group = (pet ? FALSE : TRUE);
                                int type;
 
@@ -2993,7 +2993,7 @@ msg_print("
                }
                case 20: /* Trump Hounds */
                {
-                       bool pet = success; /* was (randint(5) > 2) */
+                       bool pet = success; /* was (randint1(5) > 2) */
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¥Ï¥¦¥ó¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3046,7 +3046,7 @@ msg_print("
                        break;
                case 23: /* Trump Cyberdemon */
                {
-                       bool pet = success; /* was (randint(10) > 3) */
+                       bool pet = success; /* was (randint1(10) > 3) */
 
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
@@ -3101,7 +3101,7 @@ msg_print("
                        break;
                case 27: /* Trump Dragon */
                {
-                       bool pet = success; /* was (randint(10) > 3) */
+                       bool pet = success; /* was (randint1(10) > 3) */
                        bool group = (pet ? FALSE : TRUE);
 
 #ifdef JP
@@ -3132,7 +3132,7 @@ msg_print("
                        if (success)
                        {
                                int x, y, dx, dy, i;
-                               int b = 10 + randint(10);
+                               int b = 10 + randint1(10);
                                for (i = 0; i < b; i++)
                                {
                                        int count = 0, d = 0;
@@ -3141,8 +3141,8 @@ msg_print("
                                        {
                                                count++;
                                                if (count > 20) break;
-                                               x = px - 8 + rand_int(17);
-                                               y = py - 8 + rand_int(17);
+                                               x = px - 8 + randint0(17);
+                                               y = py - 8 + randint0(17);
 
                                                if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
 
@@ -3162,7 +3162,7 @@ msg_print("
                        break;
                case 29: /* Trump Demon */
                {
-                       bool pet = success; /* was (randint(10) > 3) */
+                       bool pet = success; /* was (randint1(10) > 3) */
                        bool group = (pet ? FALSE : TRUE);
 
 #ifdef JP
@@ -3191,7 +3191,7 @@ msg_print("
                }
                case 30: /* Trump Greater Undead */
                {
-                       bool pet = success; /* was (randint(10) > 3) */
+                       bool pet = success; /* was (randint1(10) > 3) */
                        bool group = (pet ? FALSE : TRUE);
 
 #ifdef JP
@@ -3220,7 +3220,7 @@ msg_print("
                }
                case 31: /* Trump Ancient Dragon */
                {
-                       bool pet = success; /* was (randint(10) > 3) */
+                       bool pet = success; /* was (randint1(10) > 3) */
                        bool group = (pet ? FALSE : TRUE);
                        int type;
                        if (p_ptr->pclass == CLASS_BEASTMASTER)
@@ -3348,16 +3348,16 @@ static bool cast_arcane_spell(int spell)
                (void)set_poisoned(0);
                break;
        case 14: /* Resist Cold */
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
                break;
        case 15: /* Resist Fire */
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
                break;
        case 16: /* Resist Lightning */
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
                break;
        case 17: /* Resist Acid */
-               (void)set_oppose_acid(randint(20) + 20, FALSE);
+               (void)set_oppose_acid(randint1(20) + 20, FALSE);
                break;
        case 18: /* Cure Medium Wounds */
                (void)hp_player(damroll(4, 8));
@@ -3388,7 +3388,7 @@ msg_print("
                (void)set_food(PY_FOOD_MAX - 1);
                break;
        case 24: /* See Invisible */
-               (void)set_tim_invis(randint(24) + 24, FALSE);
+               (void)set_tim_invis(randint1(24) + 24, FALSE);
                break;
        case 25: /* Conjure Elemental */
                if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, TRUE, TRUE, TRUE, FALSE, FALSE))
@@ -3410,7 +3410,7 @@ msg_print("
        case 28: /* Elemental Ball */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               switch (randint(4))
+               switch (randint1(4))
                {
                        case 1:  dummy = GF_FIRE;break;
                        case 2:  dummy = GF_ELEC;break;
@@ -3431,7 +3431,7 @@ msg_print("
                wiz_lite(FALSE, FALSE);
                if (!p_ptr->telepathy)
                {
-                       (void)set_tim_esp(randint(30) + 25, FALSE);
+                       (void)set_tim_esp(randint1(30) + 25, FALSE);
                }
                break;
        default:
@@ -3459,33 +3459,33 @@ static bool cast_enchant_spell(int spell)
        switch (spell)
        {
        case 0: /* Infravision */
-               set_tim_infra(100 + randint(100), FALSE);
+               set_tim_infra(100 + randint1(100), FALSE);
                break;
        case 1: /* Regeneration */
-               set_tim_regen(80 + randint(80), FALSE);
+               set_tim_regen(80 + randint1(80), FALSE);
                break;
        case 2: /* Satisfy Hunger */
                (void)set_food(PY_FOOD_MAX - 1);
                break;
        case 3: /* Resist Cold */
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
                break;
        case 4: /* Resist Fire */
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
                break;
        case 5: /* Heroism */
-               (void)set_hero(randint(25) + 25, FALSE);
+               (void)set_hero(randint1(25) + 25, FALSE);
                (void)hp_player(10);
                (void)set_afraid(0);
                break;
        case 6: /* Resist Lightning */
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
                break;
        case 7: /* Resist Acid */
-               (void)set_oppose_acid(randint(20) + 20, FALSE);
+               (void)set_oppose_acid(randint1(20) + 20, FALSE);
                break;
        case 8: /* See Invisibility */
-               (void)set_tim_invis(randint(24) + 24, FALSE);
+               (void)set_tim_invis(randint1(24) + 24, FALSE);
                break;
        case 9: /* Remove Curse */
                if (remove_curse())
@@ -3498,10 +3498,10 @@ static bool cast_enchant_spell(int spell)
                }
                break;
        case 10: /* Resist Poison */
-               (void)set_oppose_pois(randint(20) + 20, FALSE);
+               (void)set_oppose_pois(randint1(20) + 20, FALSE);
                break;
        case 11: /* Berserk */
-               (void)set_shero(randint(25) + 25, FALSE);
+               (void)set_shero(randint1(25) + 25, FALSE);
                (void)hp_player(30);
                (void)set_afraid(0);
                break;
@@ -3509,7 +3509,7 @@ static bool cast_enchant_spell(int spell)
                (void)self_knowledge();
                break;
        case 13: /* Protection from Evil */
-               (void)set_protevil(randint(25) + 3 * p_ptr->lev, FALSE);
+               (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
                break;
        case 14: /* Healing */
                set_poisoned(0);
@@ -3521,23 +3521,23 @@ static bool cast_enchant_spell(int spell)
                return choose_ele_attack();
                break;
        case 16: /* Telepathy */
-               (void)set_tim_esp(randint(30) + 25, FALSE);
+               (void)set_tim_esp(randint1(30) + 25, FALSE);
                break;
        case 17: /* Stone Skin */
-               (void)set_shield(randint(20) + 30, FALSE);
+               (void)set_shield(randint1(20) + 30, FALSE);
                break;
        case 18: /* Resistance */
-               (void)set_oppose_acid(randint(20) + 20, FALSE);
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
-               (void)set_oppose_pois(randint(20) + 20, FALSE);
+               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               (void)set_oppose_pois(randint1(20) + 20, FALSE);
                break;
        case 19: /* Haste */
-               (void)set_fast(randint(20 + plev) + plev, FALSE);
+               (void)set_fast(randint1(20 + plev) + plev, FALSE);
                break;
        case 20: /* Walk through Wall */
-               (void)set_kabenuke(randint(plev/2) + plev/2, FALSE);
+               (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
                break;
        case 21: /* Pulish Shield */
                (void)pulish_shield();
@@ -3557,7 +3557,7 @@ msg_print("
                }
                break;
        case 23: /* Magic armor */
-               (void)set_magicdef(randint(20) + 20, FALSE);
+               (void)set_magicdef(randint1(20) + 20, FALSE);
                break;
        case 24: /* Remove Enchantment */
                if (!mundane_spell(TRUE)) return FALSE;
@@ -3576,13 +3576,13 @@ msg_print("
                return identify_fully(FALSE);
                break;
        case 27: /* Enchant Weapon */
-               return enchant_spell(rand_int(4) + 1, rand_int(4) + 1, 0);
+               return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0);
                break;
        case 28: /* Enchant Armor */
-               return enchant_spell(0, 0, rand_int(3) + 2);
+               return enchant_spell(0, 0, randint0(3) + 2);
                break;
        case 29: /* Brand Weapon */
-               brand_weapon(rand_int(17));
+               brand_weapon(randint0(17));
                break;
        case 30: /* Living Trump */
                if (one_in_(7))
@@ -3600,7 +3600,7 @@ msg_print("
 #endif
                break;
        case 31: /* Immune */
-               return (choose_ele_immune(13 + randint(13)));
+               return (choose_ele_immune(13 + randint1(13)));
                break;
        default:
                msg_format("You cast an unknown Craft spell: %d.", spell);
@@ -3656,10 +3656,10 @@ static bool cast_daemon_spell(int spell)
                (void)detect_monsters_nonliving(DETECT_RAD_DEFAULT);
                break;
        case 2: /* Bless */
-               (void)set_blessed(randint(12) + 12, FALSE);
+               (void)set_blessed(randint1(12) + 12, FALSE);
                break;
        case 3: /* Resist Fire */
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
                break;
        case 4: /* Horrify */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -3702,7 +3702,7 @@ msg_print("
                map_area(DETECT_RAD_MAP);
                break;
        case 10: /* Resist Nether */
-               (void)set_tim_res_nether(randint(20) + 20, FALSE);
+               (void)set_tim_res_nether(randint1(20) + 20, FALSE);
                break;
        case 11: /* Plasma Bolt */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -3728,7 +3728,7 @@ msg_print("
                bool pet = !one_in_(3);
                bool group = !(pet && (plev < 50));
 
-               if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint(plev/2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
+               if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
                {
 #ifdef JP
 msg_print("ⲫ¤Î°­½­¤¬½¼Ëþ¤·¤¿¡£");
@@ -3763,11 +3763,11 @@ msg_print("
                break;
        }
        case 16: /* Telepathy */
-               (void)set_tim_esp(randint(30) + 25, FALSE);
+               (void)set_tim_esp(randint1(30) + 25, FALSE);
                break;
        case 17: /* Demoncloak */
        {
-               int dur=randint(20) + 20;
+               int dur=randint1(20) + 20;
                        
                set_oppose_fire(dur, FALSE);
                set_oppose_cold(dur, FALSE);
@@ -3777,7 +3777,7 @@ msg_print("
        }
        case 18: /* Rain of Lava */
                fire_ball(GF_FIRE, 0, (55 + plev)*2, 3);
-               fire_ball_hide(GF_LAVA_FLOW, 0, 2+randint(2), 3);
+               fire_ball_hide(GF_LAVA_FLOW, 0, 2+randint1(2), 3);
                break;
        case 19: /* Plasma ball */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -3785,11 +3785,11 @@ msg_print("
                fire_ball(GF_PLASMA, dir, plev*3/2 + 80, 2 + plev/40);
                break;
        case 20: /* Mimic demon */
-               (void)set_mimic(10+plev/2 + randint(10+plev/2), MIMIC_DEMON, FALSE);
+               (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_DEMON, FALSE);
                break;
        case 21: /* Nether Wave == Dispel Good */
-               (void)dispel_monsters(randint(plev * 2));
-               (void)dispel_good(randint(plev * 2));
+               (void)dispel_monsters(randint1(plev * 2));
+               (void)dispel_good(randint1(plev * 2));
                break;
        case 22: /*  */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -3806,12 +3806,12 @@ else msg_print("<
                fire_ball_hide(GF_HAND_DOOM, dir, plev * 2, 0);
                break;
        case 24: /* Heroism */
-               (void)set_hero(randint(25) + 25, FALSE);
+               (void)set_hero(randint1(25) + 25, FALSE);
                (void)hp_player(10);
                (void)set_afraid(0);
                break;
        case 25: /* Tim resist time */
-               (void)set_tim_res_time(randint(20)+20, FALSE);
+               (void)set_tim_res_time(randint1(20)+20, FALSE);
                break;
        case 26: /* Circle of Madness */
                fire_ball(GF_CHAOS, 0, 50+plev, 3+plev/20);
@@ -3903,14 +3903,14 @@ msg_print("
 
                fire_ball_hide(GF_BLOOD_CURSE, dir, 600, 0);
 #ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint(30), "·ì¤Î¼ö¤¤", -1);
+take_hit(DAMAGE_USELIFE, 20 + randint1(30), "·ì¤Î¼ö¤¤", -1);
 #else
-               take_hit(DAMAGE_USELIFE, 20 + randint(30), "Blood curse", -1);
+               take_hit(DAMAGE_USELIFE, 20 + randint1(30), "Blood curse", -1);
 #endif
                break;
        }
        case 31: /* Mimic Demon lord */
-               (void)set_mimic(15 + randint(15), MIMIC_DEMON_LORD, FALSE);
+               (void)set_mimic(15 + randint1(15), MIMIC_DEMON_LORD, FALSE);
                break;
        default:
                msg_format("You cast an unknown Daemon spell: %d.", spell);
@@ -4559,7 +4559,7 @@ if (!get_check("
        chance = spell_chance(spell, use_realm - 1);
 
        /* Failed spell */
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 
@@ -4573,25 +4573,25 @@ msg_format("%s
 
                if (realm == REALM_LIFE)
                {
-                       if (randint(100) < chance)
+                       if (randint1(100) < chance)
                                chg_virtue(V_FAITH, -1);
                }
                else if (realm == REALM_DEATH)
                {
-                       if (randint(100) < chance)
+                       if (randint1(100) < chance)
                                chg_virtue(V_UNLIFE, -1);
                }
                else if (realm == REALM_NATURE)
                {
-                       if (randint(100) < chance)
+                       if (randint1(100) < chance)
                                chg_virtue(V_NATURE, -1);
                }
                else if (realm == REALM_DAEMON)
                {
-                       if (randint(100) < chance)
+                       if (randint1(100) < chance)
                                chg_virtue(V_JUSTICE, 1);
                }
-               else if (randint(100) < chance)
+               else if (randint1(100) < chance)
                {
                        chg_virtue(V_KNOWLEDGE, -1);
                }
@@ -4600,7 +4600,7 @@ msg_format("%s
                {
                        cast_trump_spell(spell, FALSE);
                }
-               else if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint(100) < spell))
+               else if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell))
                {
 #ifdef JP
 msg_print("¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òȯÀ¸¤·¤¿¡ª");
@@ -4610,7 +4610,7 @@ msg_print("
 
                        wild_magic(spell);
                }
-               else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint(100) < spell))
+               else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint1(100) < spell))
                {
                        if ((sval == 3) && one_in_(2))
                        {
@@ -4634,7 +4634,7 @@ msg_print("
                                        lose_exp(spell * 250);
                        }
                }
-               else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint(200) < spell))
+               else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint1(200) < spell))
                {
 #ifdef JP
 msg_print("¤¤¤ä¤Ê²»¤¬¶Á¤¤¤¿");
@@ -4644,7 +4644,7 @@ msg_print("An infernal sound echoed.");
 
                        aggravate_monsters(0);
                }
-               if (randint(100) >= chance)
+               if (randint1(100) >= chance)
                        chg_virtue(V_CHANCE,-1);
        }
 
@@ -4693,7 +4693,7 @@ msg_print("An infernal sound echoed.");
                /* Canceled spells cost neither a turn nor mana */
                if (!cast) return;
 
-               if (randint(100) < chance)
+               if (randint1(100) < chance)
                        chg_virtue(V_CHANCE,1);
 
                /* A spell was cast */
@@ -4749,29 +4749,29 @@ msg_print("An infernal sound echoed.");
                }
                if (realm == REALM_LIFE)
                {
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_COMPASSION, 1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, 1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_COMPASSION, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
                }
                else if (realm == REALM_DEATH)
                {
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_UNLIFE, 1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_UNLIFE, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, -1);
                }
                else if (realm == REALM_DAEMON)
                {
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, -1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, -1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, -1);
                }
                else if (realm == REALM_NATURE)
                {
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_NATURE, 1);
-                       if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HARMONY, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_NATURE, 1);
+                       if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HARMONY, 1);
                }
                if (mp_ptr->spell_xtra & MAGIC_GAIN_EXP)
                {
@@ -4814,7 +4814,7 @@ msg_print("
 
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                if (realm == REALM_LIFE)
                        chg_virtue(V_FAITH, -10);
@@ -4828,9 +4828,9 @@ msg_print("
                        chg_virtue(V_KNOWLEDGE, -10);
 
                /* Damage CON (possibly permanently) */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                {
-                       bool perm = (rand_int(100) < 25);
+                       bool perm = (randint0(100) < 25);
 
                        /* Message */
 #ifdef JP
@@ -4841,7 +4841,7 @@ msg_print("
 
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_CON, 15 + randint(10), perm);
+                       (void)dec_stat(A_CON, 15 + randint1(10), perm);
                }
        }
 
@@ -5141,7 +5141,7 @@ bool rakuba(int dam, bool force)
                                        else skill_exp[GINOU_RIDING]++;
                                }
                        }
-                       if (rand_int(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10))
+                       if (randint0(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10))
                        {
                                if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3)+30))
                                {
@@ -5170,7 +5170,7 @@ bool rakuba(int dam, bool force)
                        sn++;
 
                        /* Randomize choice */
-                       if (rand_int(sn) > 0) continue;
+                       if (randint0(sn) > 0) continue;
 
                        /* Save the safe location */
                        sy = y; sx = x;
@@ -5344,7 +5344,7 @@ msg_print("
 
                        return FALSE;
                }
-               if (r_info[m_ptr->r_idx].level > randint((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
+               if (r_info[m_ptr->r_idx].level > randint1((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
                {
 #ifdef JP
 msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
index 50f6442..0d2db73 100644 (file)
@@ -92,7 +92,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
                                {
-                                       if (set_poisoned(p_ptr->poisoned + rand_int(10) + 10))
+                                       if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
                                        {
                                                ident = TRUE;
                                        }
@@ -104,7 +104,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!p_ptr->resist_blind)
                                {
-                                       if (set_blind(p_ptr->blind + rand_int(200) + 200))
+                                       if (set_blind(p_ptr->blind + randint0(200) + 200))
                                        {
                                                ident = TRUE;
                                        }
@@ -116,7 +116,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!p_ptr->resist_fear)
                                {
-                                       if (set_afraid(p_ptr->afraid + rand_int(10) + 10))
+                                       if (set_afraid(p_ptr->afraid + randint0(10) + 10))
                                        {
                                                ident = TRUE;
                                        }
@@ -128,7 +128,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!p_ptr->resist_conf)
                                {
-                                       if (set_confused(p_ptr->confused + rand_int(10) + 10))
+                                       if (set_confused(p_ptr->confused + randint0(10) + 10))
                                        {
                                                ident = TRUE;
                                        }
@@ -140,7 +140,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!p_ptr->resist_chaos)
                                {
-                                       if (set_image(p_ptr->image + rand_int(250) + 250))
+                                       if (set_image(p_ptr->image + randint0(250) + 250))
                                        {
                                                ident = TRUE;
                                        }
@@ -152,7 +152,7 @@ static void do_cmd_eat_food_aux(int item)
                        {
                                if (!p_ptr->free_act)
                                {
-                                       if (set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10))
+                                       if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
                                        {
                                                ident = TRUE;
                                        }
@@ -653,7 +653,7 @@ static void do_cmd_quaff_potion_aux(int item)
 
                case SV_POTION_SLOWNESS:
                {
-                       if (set_slow(randint(25) + 15, FALSE)) ident = TRUE;
+                       if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -676,7 +676,7 @@ static void do_cmd_quaff_potion_aux(int item)
                {
                        if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
                        {
-                               if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10))
+                               if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
                                {
                                        ident = TRUE;
                                }
@@ -688,7 +688,7 @@ static void do_cmd_quaff_potion_aux(int item)
                {
                        if (!p_ptr->resist_blind)
                        {
-                               if (set_blind(p_ptr->blind + rand_int(100) + 100))
+                               if (set_blind(p_ptr->blind + randint0(100) + 100))
                                {
                                        ident = TRUE;
                                }
@@ -702,7 +702,7 @@ static void do_cmd_quaff_potion_aux(int item)
                        else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
                        if (!p_ptr->resist_conf)
                        {
-                               if (set_confused(rand_int(20) + 15))
+                               if (set_confused(randint0(20) + 15))
                                {
                                        ident = TRUE;
                                }
@@ -712,7 +712,7 @@ static void do_cmd_quaff_potion_aux(int item)
                        {
                                if (one_in_(2))
                                {
-                                       if (set_image(p_ptr->image + rand_int(150) + 150))
+                                       if (set_image(p_ptr->image + randint0(150) + 150))
                                        {
                                                ident = TRUE;
                                        }
@@ -766,7 +766,7 @@ msg_print("
                                        /* Remove the monster restriction */
                                        get_mon_num_prep(NULL, NULL);
                                }
-                               if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4))
+                               if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
                                {
                                        ident = TRUE;
                                }
@@ -881,7 +881,7 @@ msg_print("
 
                case SV_POTION_INFRAVISION:
                {
-                       if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100), FALSE))
+                       if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
                        {
                                ident = TRUE;
                        }
@@ -890,7 +890,7 @@ msg_print("
 
                case SV_POTION_DETECT_INVIS:
                {
-                       if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12), FALSE))
+                       if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
                        {
                                ident = TRUE;
                        }
@@ -919,7 +919,7 @@ msg_print("
                {
                        if (!p_ptr->fast)
                        {
-                               if (set_fast(randint(25) + 15, FALSE)) ident = TRUE;
+                               if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
                        }
                        else
                        {
@@ -930,7 +930,7 @@ msg_print("
 
                case SV_POTION_RESIST_HEAT:
                {
-                       if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10, FALSE))
+                       if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
                        {
                                ident = TRUE;
                        }
@@ -939,7 +939,7 @@ msg_print("
 
                case SV_POTION_RESIST_COLD:
                {
-                       if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10, FALSE))
+                       if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
                        {
                                ident = TRUE;
                        }
@@ -949,7 +949,7 @@ msg_print("
                case SV_POTION_HEROISM:
                {
                        if (set_afraid(0)) ident = TRUE;
-                       if (set_hero(p_ptr->hero + randint(25) + 25, FALSE)) ident = TRUE;
+                       if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
                        if (hp_player(10)) ident = TRUE;
                        break;
                }
@@ -957,7 +957,7 @@ msg_print("
                case SV_POTION_BESERK_STRENGTH:
                {
                        if (set_afraid(0)) ident = TRUE;
-                       if (set_shero(p_ptr->shero + randint(25) + 25, FALSE)) ident = TRUE;
+                       if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
                        if (hp_player(30)) ident = TRUE;
                        break;
                }
@@ -1257,11 +1257,11 @@ msg_print("
 
                case SV_POTION_RESISTANCE:
                {
-                       (void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20, FALSE);
-                       (void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20, FALSE);
-                       (void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20, FALSE);
-                       (void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20, FALSE);
-                       (void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20, FALSE);
+                       (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
+                       (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
+                       (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
+                       (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
+                       (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
                        ident = TRUE;
                        break;
                }
@@ -1280,7 +1280,7 @@ msg_print("
 
                case SV_POTION_INVULNERABILITY:
                {
-                       (void)set_invuln(p_ptr->invuln + randint(4) + 4, FALSE);
+                       (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
                        ident = TRUE;
                        break;
                }
@@ -1311,7 +1311,7 @@ msg_print("
                case SV_POTION_NEO_TSUYOSHI:
                {
                        (void)set_image(0);
-                       (void)set_tsuyoshi(p_ptr->tsuyoshi + randint(100) + 100, FALSE);
+                       (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
                        ident = TRUE;
                        break;
                }
@@ -1328,7 +1328,7 @@ msg_print("
                        (void)set_tsuyoshi(0, TRUE);
                        if (!p_ptr->resist_chaos)
                        {
-                               (void)set_image(50 + randint(50));
+                               (void)set_image(50 + randint1(50));
                        }
                        ident = TRUE;
                        break;
@@ -1542,7 +1542,7 @@ static void do_cmd_read_scroll_aux(int item)
                {
                        if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
                        {
-                               (void)set_blind(p_ptr->blind + 3 + randint(5));
+                               (void)set_blind(p_ptr->blind + 3 + randint1(5));
                        }
                        if (unlite_area(10, 3)) ident = TRUE;
                        break;
@@ -1575,7 +1575,7 @@ static void do_cmd_read_scroll_aux(int item)
 
                case SV_SCROLL_SUMMON_MONSTER:
                {
-                       for (k = 0; k < randint(3); k++)
+                       for (k = 0; k < randint1(3); k++)
                        {
                                if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
                                {
@@ -1587,7 +1587,7 @@ static void do_cmd_read_scroll_aux(int item)
 
                case SV_SCROLL_SUMMON_UNDEAD:
                {
-                       for (k = 0; k < randint(3); k++)
+                       for (k = 0; k < randint1(3); k++)
                        {
                                if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, TRUE, FALSE, FALSE, TRUE, TRUE))
                                {
@@ -1715,14 +1715,14 @@ static void do_cmd_read_scroll_aux(int item)
 
                case SV_SCROLL_STAR_ENCHANT_ARMOR:
                {
-                       if (!enchant_spell(0, 0, randint(3) + 2)) used_up = FALSE;
+                       if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
                        ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_STAR_ENCHANT_WEAPON:
                {
-                       if (!enchant_spell(randint(3), randint(3), 0)) used_up = FALSE;
+                       if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
                        ident = TRUE;
                        break;
                }
@@ -1794,19 +1794,19 @@ static void do_cmd_read_scroll_aux(int item)
 
                case SV_SCROLL_BLESSING:
                {
-                       if (set_blessed(p_ptr->blessed + randint(12) + 6, FALSE)) ident = TRUE;
+                       if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_HOLY_CHANT:
                {
-                       if (set_blessed(p_ptr->blessed + randint(24) + 12, FALSE)) ident = TRUE;
+                       if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_HOLY_PRAYER:
                {
-                       if (set_blessed(p_ptr->blessed + randint(48) + 24, FALSE)) ident = TRUE;
+                       if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -1830,7 +1830,7 @@ static void do_cmd_read_scroll_aux(int item)
                case SV_SCROLL_PROTECTION_FROM_EVIL:
                {
                        k = 3 * p_ptr->lev;
-                       if (set_protevil(p_ptr->protevil + randint(25) + k, FALSE)) ident = TRUE;
+                       if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -1849,7 +1849,7 @@ static void do_cmd_read_scroll_aux(int item)
 
                case SV_SCROLL_STAR_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+rand_int(5), TRUE))
+                       if (destroy_area(py, px, 13+randint0(5), TRUE))
                                ident = TRUE;
                        else
 #ifdef JP
@@ -1900,7 +1900,7 @@ msg_print("
 
                case SV_SCROLL_STAR_ACQUIREMENT:
                {
-                       acquirement(py, px, randint(2) + 1, TRUE, FALSE);
+                       acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
                        ident = TRUE;
                        break;
                }
@@ -1912,9 +1912,9 @@ msg_print("
                        /* Note: "Double" damage since it is centered on the player ... */
                        if (!(p_ptr->oppose_fire || p_ptr->resist_fire || p_ptr->immune_fire))
 #ifdef JP
-take_hit(DAMAGE_NOESCAPE, 50+randint(50), "±ê¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "±ê¤Î´¬Êª", -1);
 #else
-                               take_hit(DAMAGE_NOESCAPE, 50 + randint(50), "a Scroll of Fire", -1);
+                               take_hit(DAMAGE_NOESCAPE, 50 + randint1(50), "a Scroll of Fire", -1);
 #endif
 
                        ident = TRUE;
@@ -1927,9 +1927,9 @@ take_hit(DAMAGE_NOESCAPE, 50+randint(50), "
                        fire_ball(GF_ICE, 0, 777, 4);
                        if (!(p_ptr->oppose_cold || p_ptr->resist_cold || p_ptr->immune_cold))
 #ifdef JP
-take_hit(DAMAGE_NOESCAPE, 100+randint(100), "ɹ¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 100+randint1(100), "ɹ¤Î´¬Êª", -1);
 #else
-                               take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "a Scroll of Ice", -1);
+                               take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "a Scroll of Ice", -1);
 #endif
 
                        ident = TRUE;
@@ -1941,9 +1941,9 @@ take_hit(DAMAGE_NOESCAPE, 100+randint(100), "ɹ
                        fire_ball(GF_CHAOS, 0, 1000, 4);
                        if (!p_ptr->resist_chaos)
 #ifdef JP
-take_hit(DAMAGE_NOESCAPE, 111+randint(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 111+randint1(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
 #else
-                               take_hit(DAMAGE_NOESCAPE, 111 + randint(111), "a Scroll of Logrus", -1);
+                               take_hit(DAMAGE_NOESCAPE, 111 + randint1(111), "a Scroll of Logrus", -1);
 #endif
 
                        ident = TRUE;
@@ -1954,7 +1954,7 @@ take_hit(DAMAGE_NOESCAPE, 111+randint(111), "
                {
                        errr err = 0;
 
-                       switch (randint(20))
+                       switch (randint1(20))
                        {
                                case 1:
 #ifdef JP
@@ -2231,7 +2231,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic)
                {
                        if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
                        {
-                               if (set_blind(p_ptr->blind + 3 + randint(5))) ident = TRUE;
+                               if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
                        }
                        if (unlite_area(10, 3)) ident = TRUE;
                        break;
@@ -2239,7 +2239,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic)
 
                case SV_STAFF_SLOWNESS:
                {
-                       if (set_slow(p_ptr->slow + randint(30) + 15, FALSE)) ident = TRUE;
+                       if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -2251,7 +2251,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic)
 
                case SV_STAFF_SUMMONING:
                {
-                       for (k = 0; k < randint(4); k++)
+                       for (k = 0; k < randint1(4); k++)
                        {
                                if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
                                {
@@ -2451,7 +2451,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic)
 
                case SV_STAFF_SPEED:
                {
-                       if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
+                       if (set_fast(randint1(30) + 15, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -2478,7 +2478,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic)
                {
                        if (dispel_evil(150)) ident = TRUE;
                        k = 3 * p_ptr->lev;
-                       if (set_protevil((magic ? 0 : p_ptr->protevil) + randint(25) + k, FALSE)) ident = TRUE;
+                       if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
                        if (set_poisoned(0)) ident = TRUE;
                        if (set_afraid(0)) ident = TRUE;
                        if (hp_player(50)) ident = TRUE;
@@ -2511,7 +2511,7 @@ msg_print("
 
                case SV_STAFF_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+rand_int(5), TRUE))
+                       if (destroy_area(py, px, 13+randint0(5), TRUE))
                                ident = TRUE;
 
                        break;
@@ -2533,7 +2533,7 @@ msg_print("
                        msg_print("Mighty magics rend your enemies!");
 #endif
                        project(0, 5, py, px,
-                               (randint(200) + 300) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID | PROJECT_NO_REF, -1);
+                               (randint1(200) + 300) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID | PROJECT_NO_REF, -1);
                        if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE))
                        {
 #ifdef JP
@@ -2629,7 +2629,7 @@ static void do_cmd_use_staff_aux(int item)
        }
 
        /* Roll for usage */
-       if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
+       if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
        {
                if (flush_failure) flush();
 #ifdef JP
@@ -2779,19 +2779,19 @@ static int wand_effect(int sval, int dir, bool magic)
        if (sval == SV_WAND_WONDER)
        {
                int vir = virtue_number(V_CHANCE);
-               sval = rand_int(SV_WAND_WONDER);
+               sval = randint0(SV_WAND_WONDER);
 
                if (vir)
                {
                        if (p_ptr->virtues[vir - 1] > 0)
                        {
-                               while (randint(300) < p_ptr->virtues[vir - 1]) sval++;
-                               if (sval > SV_WAND_COLD_BALL) sval = rand_int(4) + SV_WAND_ACID_BALL;
+                               while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
+                               if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
                        }
                        else
                        {
-                               while (randint(300) < (0-p_ptr->virtues[vir - 1])) sval--;
-                               if (sval < SV_WAND_HEAL_MONSTER) sval = rand_int(3) + SV_WAND_HEAL_MONSTER;
+                               while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
+                               if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
                        }
                }
                if (sval < SV_WAND_TELEPORT_AWAY)
@@ -2989,7 +2989,7 @@ static int wand_effect(int sval, int dir, bool magic)
 
                case SV_WAND_DRAGON_BREATH:
                {
-                       switch (randint(5))
+                       switch (randint1(5))
                        {
                                case 1:
                                {
@@ -3028,7 +3028,7 @@ static int wand_effect(int sval, int dir, bool magic)
 
                case SV_WAND_DISINTEGRATE:
                {
-                       fire_ball(GF_DISINTEGRATE, dir, 200 + randint(p_ptr->lev * 2), 2);
+                       fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(p_ptr->lev * 2), 2);
                        ident = TRUE;
                        break;
                }
@@ -3162,7 +3162,7 @@ static void do_cmd_aim_wand_aux(int item)
        }
 
        /* Roll for usage */
-       if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
+       if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
        {
                if (flush_failure) flush();
 #ifdef JP
@@ -3364,7 +3364,7 @@ static int rod_effect(int sval, int dir, bool *use_charge, bool magic)
 
                case SV_ROD_SPEED:
                {
-                       if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
+                       if (set_fast(randint1(30) + 15, FALSE)) ident = TRUE;
                        break;
                }
 
@@ -3592,12 +3592,12 @@ static void do_cmd_zap_rod_aux(int item)
        if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
        {
-               if (rand_int(chance*2) < fail) success = FALSE;
+               if (randint0(chance*2) < fail) success = FALSE;
                else success = TRUE;
        }
        else
        {
-               if (rand_int(fail*2) < chance) success = TRUE;
+               if (randint0(fail*2) < chance) success = TRUE;
                else success = FALSE;
        }
 
@@ -3742,7 +3742,7 @@ static bool item_tester_hook_activate(object_type *o_ptr)
 void ring_of_power(int dir)
 {
        /* Pick a random effect */
-       switch (randint(10))
+       switch (randint1(10))
        {
                case 1:
                case 2:
@@ -4004,12 +4004,12 @@ static void do_cmd_activate_aux(int item)
        if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
        {
-               if (rand_int(chance*2) < fail) success = FALSE;
+               if (randint0(chance*2) < fail) success = FALSE;
                else success = TRUE;
        }
        else
        {
-               if (rand_int(fail*2) < chance) success = TRUE;
+               if (randint0(fail*2) < chance) success = TRUE;
                else success = FALSE;
        }
 
@@ -4078,7 +4078,7 @@ static void do_cmd_activate_aux(int item)
 #endif
 
                                lite_area(damroll(2, 15), 3);
-                               o_ptr->timeout = rand_int(10) + 10;
+                               o_ptr->timeout = randint0(10) + 10;
                                break;
                        }
 
@@ -4092,7 +4092,7 @@ static void do_cmd_activate_aux(int item)
 
                                map_area(DETECT_RAD_MAP);
                                lite_area(damroll(2, 15), 3);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        }
 
@@ -4129,7 +4129,7 @@ if (get_check("
                                        (void)word_of_recall();
                                }
 
-                               o_ptr->timeout = rand_int(20) + 20;
+                               o_ptr->timeout = randint0(20) + 20;
                                break;
                        }
 
@@ -4142,8 +4142,8 @@ if (get_check("
 #endif
 
                                k = 3 * p_ptr->lev;
-                               (void)set_protevil(randint(25) + k, FALSE);
-                               o_ptr->timeout = rand_int(225) + 225;
+                               (void)set_protevil(randint1(25) + k, FALSE);
+                               o_ptr->timeout = randint0(225) + 225;
                                break;
                        }
 
@@ -4156,7 +4156,7 @@ if (get_check("
 #endif
 
                                dispel_evil(p_ptr->lev * 5);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -4169,7 +4169,7 @@ if (get_check("
 #endif
 
                                dispel_evil(p_ptr->lev * 5);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -4183,7 +4183,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                if (drain_life(dir, 100))
-                               o_ptr->timeout = rand_int(100) + 100;
+                               o_ptr->timeout = randint0(100) + 100;
                                break;
                        }
 
@@ -4195,8 +4195,8 @@ msg_print("
                                msg_print("The ring glows brightly...");
 #endif
 
-                               (void)set_fast(randint(75) + 75, FALSE);
-                               o_ptr->timeout = rand_int(150) + 150;
+                               (void)set_fast(randint1(75) + 75, FALSE);
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
 
@@ -4210,7 +4210,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_FIRE, dir, 300, 3);
-                               o_ptr->timeout = rand_int(225) + 225;
+                               o_ptr->timeout = randint0(225) + 225;
                                break;
                        }
 
@@ -4224,7 +4224,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_COLD, dir, 400, 3);
-                               o_ptr->timeout = rand_int(325) + 325;
+                               o_ptr->timeout = randint0(325) + 325;
                                break;
                        }
 
@@ -4239,7 +4239,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_ELEC, dir, 500, 3);
-                               o_ptr->timeout = rand_int(425) + 425;
+                               o_ptr->timeout = randint0(425) + 425;
                                break;
                        }
 
@@ -4254,7 +4254,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                ring_of_power(dir);
-                               o_ptr->timeout = rand_int(450) + 450;
+                               o_ptr->timeout = randint0(450) + 450;
                                break;
                        }
 
@@ -4309,14 +4309,14 @@ msg_print("
 #endif
 
                                (void)set_afraid(0);
-                               (void)set_hero(randint(50) + 50, FALSE);
+                               (void)set_hero(randint1(50) + 50, FALSE);
                                (void)hp_player(10);
-                               (void)set_blessed(randint(50) + 50, FALSE);
-                               (void)set_oppose_acid(randint(50) + 50, FALSE);
-                               (void)set_oppose_elec(randint(50) + 50, FALSE);
-                               (void)set_oppose_fire(randint(50) + 50, FALSE);
-                               (void)set_oppose_cold(randint(50) + 50, FALSE);
-                               (void)set_oppose_pois(randint(50) + 50, FALSE);
+                               (void)set_blessed(randint1(50) + 50, FALSE);
+                               (void)set_oppose_acid(randint1(50) + 50, FALSE);
+                               (void)set_oppose_elec(randint1(50) + 50, FALSE);
+                               (void)set_oppose_fire(randint1(50) + 50, FALSE);
+                               (void)set_oppose_cold(randint1(50) + 50, FALSE);
+                               (void)set_oppose_pois(randint1(50) + 50, FALSE);
                                o_ptr->timeout = 400;
                                break;
                        }
@@ -4350,7 +4350,7 @@ msg_print("ŷ
                                (void)set_stun(0);
                                (void)set_confused(0);
                                (void)set_blind(0);
-                               (void)set_hero(randint(25) + 25, FALSE);
+                               (void)set_hero(randint1(25) + 25, FALSE);
                                (void)hp_player(777);
                                o_ptr->timeout = 300;
                                break;
@@ -4403,7 +4403,7 @@ msg_print("ŷ
 #endif
 
                                detect_all(DETECT_RAD_DEFAULT);
-                               o_ptr->timeout = rand_int(55) + 55;
+                               o_ptr->timeout = randint0(55) + 55;
                                break;
                        }
 
@@ -4432,11 +4432,11 @@ msg_print("ŷ
                                msg_format("Your cloak glows many colours...");
 #endif
 
-                               (void)set_oppose_acid(randint(20) + 20, FALSE);
-                               (void)set_oppose_elec(randint(20) + 20, FALSE);
-                               (void)set_oppose_fire(randint(20) + 20, FALSE);
-                               (void)set_oppose_cold(randint(20) + 20, FALSE);
-                               (void)set_oppose_pois(randint(20) + 20, FALSE);
+                               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+                               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+                               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                               (void)set_oppose_pois(randint1(20) + 20, FALSE);
                                o_ptr->timeout = 111;
                                break;
                        }
@@ -4517,7 +4517,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                               o_ptr->timeout = rand_int(8) + 8;
+                               o_ptr->timeout = randint0(8) + 8;
                                break;
                        }
 
@@ -4531,7 +4531,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_COLD, dir, damroll(6, 8));
-                               o_ptr->timeout = rand_int(7) + 7;
+                               o_ptr->timeout = randint0(7) + 7;
                                break;
                        }
 
@@ -4545,7 +4545,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                               o_ptr->timeout = rand_int(5) + 5;
+                               o_ptr->timeout = randint0(5) + 5;
                                break;
                        }
 
@@ -4559,7 +4559,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_ACID, dir, damroll(5, 8));
-                               o_ptr->timeout = rand_int(6) + 6;
+                               o_ptr->timeout = randint0(6) + 6;
                                break;
                        }
 
@@ -4573,7 +4573,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_ARROW, dir, 150);
-                               o_ptr->timeout = rand_int(90) + 90;
+                               o_ptr->timeout = randint0(90) + 90;
                                break;
                        }
 
@@ -4585,7 +4585,7 @@ msg_print("ŷ
                                msg_print("Your boots glow bright green...");
 #endif
 
-                               (void)set_fast(randint(20) + 20, FALSE);
+                               (void)set_fast(randint1(20) + 20, FALSE);
                                o_ptr->timeout = 200;
                                break;
                        }
@@ -4614,7 +4614,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                               o_ptr->timeout = rand_int(8) + 8;
+                               o_ptr->timeout = randint0(8) + 8;
                                break;
                        }
 
@@ -4628,7 +4628,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_COLD, dir, damroll(6, 8));
-                               o_ptr->timeout = rand_int(7) + 7;
+                               o_ptr->timeout = randint0(7) + 7;
                                break;
                        }
 
@@ -4642,7 +4642,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                               o_ptr->timeout = rand_int(5) + 5;
+                               o_ptr->timeout = randint0(5) + 5;
                                break;
                        }
 
@@ -4656,7 +4656,7 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_POIS, dir, 12, 3);
-                               o_ptr->timeout = rand_int(4) + 4;
+                               o_ptr->timeout = randint0(4) + 4;
                                break;
                        }
 
@@ -4684,14 +4684,14 @@ msg_print("ŷ
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_COLD, dir, 48, 2);
-                               o_ptr->timeout = rand_int(5) + 5;
+                               o_ptr->timeout = randint0(5) + 5;
                                break;
                        }
 
                        case ART_KUSANAGI:
                        case ART_ANGUIREL:
                        {
-                               switch (randint(13))
+                               switch (randint1(13))
                                {
                                case 1: case 2: case 3: case 4: case 5:
                                        teleport_player(10);
@@ -4750,7 +4750,7 @@ msg_print("
 #endif
 
                                (void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, TRUE, TRUE, TRUE, FALSE, FALSE);
-                               o_ptr->timeout = 500 + randint(500);
+                               o_ptr->timeout = 500 + randint1(500);
                                break;
                        }
 
@@ -4861,7 +4861,7 @@ msg_print("
 
                                hp_player(damroll(4, 8));
                                (void)set_cut((p_ptr->cut / 2) - 50);
-                               o_ptr->timeout = rand_int(3) + 3;
+                               o_ptr->timeout = randint0(3) + 3;
                                break;
                        }
 
@@ -4953,8 +4953,8 @@ msg_print("
                                msg_print("Your mace glows bright green...");
 #endif
 
-                               (void)set_fast(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(100) + 100;
+                               (void)set_fast(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(100) + 100;
                                break;
                        }
 
@@ -5126,11 +5126,11 @@ msg_print("
 
                                                /* Hack -- Bypass free action */
                                                (void)set_paralyzed(p_ptr->paralyzed +
-                                                       randint(5 * oops + 1));
+                                                       randint1(5 * oops + 1));
 
                                                /* Confusing. */
                                                (void)set_confused(p_ptr->confused +
-                                                       randint(5 * oops + 1));
+                                                       randint1(5 * oops + 1));
                                        }
 
                                        /* Redraw mana */
@@ -5145,7 +5145,7 @@ msg_print("
 
                                /* Confusing. */
                                if (one_in_(5)) (void)set_confused(p_ptr->confused +
-                                       randint(10));
+                                       randint1(10));
 
                                /* Exercise a little care... */
                                if (one_in_(20))
@@ -5162,7 +5162,7 @@ msg_print("
                        {
                                msg_print("You wind a mighty blast; your enemies tremble!");
                                (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
-                               o_ptr->timeout = rand_int(40) + 40;
+                               o_ptr->timeout = randint0(40) + 40;
                                break;
                        }
                        case ART_FARAMIR:
@@ -5173,7 +5173,7 @@ msg_print("
                                msg_print("You exterminate small life.");
 #endif
                                (void)dispel_monsters(4);
-                               o_ptr->timeout = rand_int(55) + 55;
+                               o_ptr->timeout = randint0(55) + 55;
                                break;
                        }
 
@@ -5184,8 +5184,8 @@ msg_print("
 #else
                                msg_print("A shrill wailing sound surrounds you.");
 #endif
-                               (void)set_protevil(randint(25) + p_ptr->lev, FALSE);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               (void)set_protevil(randint1(25) + p_ptr->lev, FALSE);
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -5199,16 +5199,16 @@ msg_print("
 #endif
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_MANA, dir, 120);
-                               o_ptr->timeout = rand_int(120) + 120;
+                               o_ptr->timeout = randint0(120) + 120;
                                break;
                        }
                        case ART_HURIN:
                        {
-                               (void)set_fast(randint(50) + 50, FALSE);
+                               (void)set_fast(randint1(50) + 50, FALSE);
                                hp_player(10);
                                set_afraid(0);
-                               set_hero(randint(50) + 50, FALSE);
-                               o_ptr->timeout = rand_int(200) + 100;
+                               set_hero(randint1(50) + 50, FALSE);
+                               o_ptr->timeout = randint0(200) + 100;
                                break;
                        }
                        case ART_GIL_GALAD:
@@ -5270,7 +5270,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_MANA, dir, 400, 4);
-                               o_ptr->timeout = rand_int(250) + 250;
+                               o_ptr->timeout = randint0(250) + 250;
                                break;
                        }
                        case ART_TAIKOBO:
@@ -5316,7 +5316,7 @@ msg_print("
 #endif
 
                                fetch(dir, 500, TRUE);
-                               o_ptr->timeout = rand_int(25) + 25;
+                               o_ptr->timeout = randint0(25) + 25;
                                break;
                        }
                        case ART_ARRYU:
@@ -5342,7 +5342,7 @@ msg_print("
 
                                }
 
-                               o_ptr->timeout = 300 + randint(150);
+                               o_ptr->timeout = 300 + randint1(150);
                                break;
                        }
 
@@ -5356,7 +5356,7 @@ msg_print("
 
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_LITE, dir, 200, 3);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -5424,7 +5424,7 @@ msg_print("
                                        msg_print("Nothing happen.");
 #endif
                                }
-                               o_ptr->timeout = rand_int(150) + 150;
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
 
@@ -5442,9 +5442,9 @@ msg_print("
                        case ART_MATOI:
                        case ART_AEGISFANG:
                        {
-                               set_hero(randint(25)+25, FALSE);
+                               set_hero(randint1(25)+25, FALSE);
                                hp_player(10);
-                               o_ptr->timeout = rand_int(30) + 30;
+                               o_ptr->timeout = randint0(30) + 30;
                                break;
                        }
 
@@ -5492,16 +5492,16 @@ msg_print("
 #endif
                                o_ptr->art_flags1 = a_info[ART_BLOOD].flags1;
                                o_ptr->art_flags2 = a_info[ART_BLOOD].flags2;
-                               dummy = randint(2)+randint(2);
+                               dummy = randint1(2)+randint1(2);
                                for (i = 0; i < dummy; i++)
-                                       o_ptr->art_flags1 |= (TR1_CHAOTIC << rand_int(18));
-                               dummy = randint(2);
+                                       o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
+                               dummy = randint1(2);
                                for (i = 0; i < dummy; i++)
-                                       random_resistance(o_ptr, FALSE, randint(34) + 4);
+                                       random_resistance(o_ptr, FALSE, randint1(34) + 4);
                                dummy = 2;
                                for (i = 0; i < dummy; i++)
                                {
-                                       int tmp = rand_int(11);
+                                       int tmp = randint0(11);
                                        if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
                                        else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
                                }
@@ -5517,9 +5517,9 @@ msg_print("
 #else
                                msg_print("You stamp. (as if you are in a ring.)");
 #endif
-                               (void)set_hero(randint(20) + 20, FALSE);
+                               (void)set_hero(randint1(20) + 20, FALSE);
                                dispel_evil(p_ptr->lev * 3);
-                               o_ptr->timeout = 100 + randint(100);
+                               o_ptr->timeout = 100 + randint1(100);
                                break;
                        }
                        case ART_MOOK:
@@ -5529,8 +5529,8 @@ msg_print("
 #else
                                msg_print("Your cloak grows white.");
 #endif
-                               (void)set_oppose_cold(randint(20) + 20, FALSE);
-                               o_ptr->timeout = 40 + randint(40);
+                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = 40 + randint1(40);
                                break;
                        }
                        case ART_VIOLET:
@@ -5542,8 +5542,8 @@ msg_print("
 #endif
 
                                k = 3 * p_ptr->lev;
-                               (void)set_protevil(randint(25) + k, FALSE);
-                               o_ptr->timeout = rand_int(225) + 225;
+                               (void)set_protevil(randint1(25) + k, FALSE);
+                               o_ptr->timeout = randint0(225) + 225;
                                break;
                        }
                        case ART_JIZO:
@@ -5568,7 +5568,7 @@ msg_print("
 
                                }
 
-                               o_ptr->timeout = 300 + randint(150);
+                               o_ptr->timeout = 300 + randint1(150);
                                break;
                        }
 
@@ -5581,7 +5581,7 @@ msg_print("
 #endif
 
                                dispel_evil(p_ptr->lev * 5);
-                               o_ptr->timeout = rand_int(100) + 100;
+                               o_ptr->timeout = randint0(100) + 100;
                                break;
                        }
 
@@ -5594,7 +5594,7 @@ msg_print("
 #endif
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_DARK, dir, 250, 4);
-                               o_ptr->timeout = rand_int(150) + 150;
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
                }
@@ -5608,36 +5608,36 @@ msg_print("
 
        else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID))
        {
-               (void)set_oppose_acid(randint(20) + 20, FALSE);
-               o_ptr->timeout = rand_int(50) + 50;
+               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+               o_ptr->timeout = randint0(50) + 50;
                return;
        }
 
        else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC))
        {
-               (void)set_oppose_elec(randint(20) + 20, FALSE);
-               o_ptr->timeout = rand_int(50) + 50;
+               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+               o_ptr->timeout = randint0(50) + 50;
                return;
        }
 
        else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE))
        {
-               (void)set_oppose_fire(randint(20) + 20, FALSE);
-               o_ptr->timeout = rand_int(50) + 50;
+               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+               o_ptr->timeout = randint0(50) + 50;
                return;
        }
 
        else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD))
        {
-               (void)set_oppose_cold(randint(20) + 20, FALSE);
-               o_ptr->timeout = rand_int(50) + 50;
+               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+               o_ptr->timeout = randint0(50) + 50;
                return;
        }
 
        else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_EARTHQUAKE))
        {
                earthquake(py, px, 5);
-               o_ptr->timeout = 100 + randint(100);
+               o_ptr->timeout = 100 + randint1(100);
 
                /* Window stuff */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -5650,7 +5650,7 @@ msg_print("
        else if (o_ptr->name2 == EGO_TRUMP)
        {
                teleport_player(100);
-               o_ptr->timeout = 50 + randint(50);
+               o_ptr->timeout = 50 + randint1(50);
 
                /* Window stuff */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -5673,7 +5673,7 @@ msg_print("
                        return;
                }
                lite_area(damroll(2, 15), 3);
-               o_ptr->timeout = rand_int(10) + 10;
+               o_ptr->timeout = randint0(10) + 10;
 
                /* Window stuff */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -5685,7 +5685,7 @@ msg_print("
        else if (o_ptr->name2 == EGO_EARTHQUAKES)
        {
                earthquake(py, px, 5);
-               o_ptr->timeout = 100 + randint(100);
+               o_ptr->timeout = 100 + randint1(100);
 
                /* Window stuff */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -5698,7 +5698,7 @@ msg_print("
        else if (o_ptr->name2 == EGO_JUMP)
        {
                teleport_player(10);
-               o_ptr->timeout = 10 + randint(10);
+               o_ptr->timeout = 10 + randint1(10);
 
                /* Window stuff */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -5726,7 +5726,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_ELEC, dir, 100, -2);
-                               o_ptr->timeout = rand_int(150) + 150;
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
 
@@ -5739,7 +5739,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_COLD, dir, 110, -2);
-                               o_ptr->timeout = rand_int(150) + 150;
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
 
@@ -5752,7 +5752,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_ACID, dir, 130, -2);
-                               o_ptr->timeout = rand_int(150) + 150;
+                               o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
 
@@ -5765,7 +5765,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_POIS, dir, 150, -2);
-                               o_ptr->timeout = rand_int(180) + 180;
+                               o_ptr->timeout = randint0(180) + 180;
                                break;
                        }
 
@@ -5778,13 +5778,13 @@ msg_print("
 #endif
 
                                fire_ball(GF_FIRE, dir, 200, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
                        case SV_DRAGON_MULTIHUED:
                        {
-                               chance = rand_int(5);
+                               chance = randint0(5);
 #ifdef JP
                                msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
                                           ((chance == 1) ? "°ðºÊ" :
@@ -5804,7 +5804,7 @@ msg_print("
                                            ((chance == 3) ? GF_ACID :
                                             ((chance == 4) ? GF_POIS : GF_FIRE)))),
                                          dir, 250, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -5817,7 +5817,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_CONFUSION, dir, 120, -2);
-                               o_ptr->timeout = rand_int(180) + 180;
+                               o_ptr->timeout = randint0(180) + 180;
                                break;
                        }
 
@@ -5830,13 +5830,13 @@ msg_print("
 #endif
 
                                fire_ball(GF_SOUND, dir, 130, -2);
-                               o_ptr->timeout = rand_int(180) + 180;
+                               o_ptr->timeout = randint0(180) + 180;
                                break;
                        }
 
                        case SV_DRAGON_CHAOS:
                        {
-                               chance = rand_int(2);
+                               chance = randint0(2);
 #ifdef JP
                                msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
                                           ((chance == 1 ? "¥«¥ª¥¹" : "Îô²½")));
@@ -5847,13 +5847,13 @@ msg_print("
 
                                fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT),
                                          dir, 220, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
                        case SV_DRAGON_LAW:
                        {
-                               chance = rand_int(2);
+                               chance = randint0(2);
 #ifdef JP
                                msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
                                           ((chance == 1 ? "¹ì²»" : "ÇËÊÒ")));
@@ -5864,13 +5864,13 @@ msg_print("
 
                                fire_ball((chance == 1 ? GF_SOUND : GF_SHARDS),
                                          dir, 230, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
                        case SV_DRAGON_BALANCE:
                        {
-                               chance = rand_int(4);
+                               chance = randint0(4);
 #ifdef JP
                                msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿",
                                           ((chance == 1) ? "¥«¥ª¥¹" :
@@ -5887,13 +5887,13 @@ msg_print("
                                           ((chance == 2) ? GF_DISENCHANT :
                                            ((chance == 3) ? GF_SOUND : GF_SHARDS))),
                                          dir, 250, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
                        case SV_DRAGON_SHINING:
                        {
-                               chance = rand_int(2);
+                               chance = randint0(2);
 #ifdef JP
                                msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
                                           ((chance == 0 ? "Á®¸÷" : "°Å¹õ")));
@@ -5903,7 +5903,7 @@ msg_print("
 #endif
 
                                fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, -2);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
 
@@ -5916,7 +5916,7 @@ msg_print("
 #endif
 
                                fire_ball(GF_MISSILE, dir, 300, -3);
-                               o_ptr->timeout = rand_int(200) + 200;
+                               o_ptr->timeout = randint0(200) + 200;
                                break;
                        }
                }
@@ -5938,9 +5938,9 @@ msg_print("
                        {
                        case EGO_RING_HERO:
                                (void)set_afraid(0);
-                               (void)set_hero(randint(25) + 25, FALSE);
+                               (void)set_hero(randint1(25) + 25, FALSE);
                                (void)hp_player(10);
-                               o_ptr->timeout = randint(100)+100;
+                               o_ptr->timeout = randint1(100)+100;
                                break;
                        case EGO_RING_MAGIC_MIS:
                                if (!get_aim_dir(&dir)) return;
@@ -5950,47 +5950,47 @@ msg_print("
                        case EGO_RING_FIRE_BOLT:
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                               o_ptr->timeout = rand_int(8) + 8;
+                               o_ptr->timeout = randint0(8) + 8;
                                break;
                        case EGO_RING_COLD_BOLT:
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_COLD, dir, damroll(6, 8));
-                               o_ptr->timeout = rand_int(7) + 7;
+                               o_ptr->timeout = randint0(7) + 7;
                                break;
                        case EGO_RING_ELEC_BOLT:
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                               o_ptr->timeout = rand_int(5) + 5;
+                               o_ptr->timeout = randint0(5) + 5;
                                break;
                        case EGO_RING_ACID_BOLT:
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_FIRE, dir, damroll(5, 8));
-                               o_ptr->timeout = rand_int(6) + 6;
+                               o_ptr->timeout = randint0(6) + 6;
                                break;
                        case EGO_RING_MANA_BOLT:
                                if (!get_aim_dir(&dir)) return;
                                fire_bolt(GF_MANA, dir, 120);
-                               o_ptr->timeout = rand_int(120)+120;
+                               o_ptr->timeout = randint0(120)+120;
                                break;
                        case EGO_RING_FIRE_BALL:
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_FIRE, dir, 100, 2);
-                               o_ptr->timeout = rand_int(80) + 80;
+                               o_ptr->timeout = randint0(80) + 80;
                                break;
                        case EGO_RING_COLD_BALL:
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_COLD, dir, 100, 2);
-                               o_ptr->timeout = rand_int(80) + 80;
+                               o_ptr->timeout = randint0(80) + 80;
                                break;
                        case EGO_RING_ELEC_BALL:
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_ELEC, dir, 100, 2);
-                               o_ptr->timeout = rand_int(80) + 80;
+                               o_ptr->timeout = randint0(80) + 80;
                                break;
                        case EGO_RING_ACID_BALL:
                                if (!get_aim_dir(&dir)) return;
                                fire_ball(GF_ACID, dir, 100, 2);
-                               o_ptr->timeout = rand_int(80) + 80;
+                               o_ptr->timeout = randint0(80) + 80;
                                break;
                        case EGO_RING_MANA_BALL:
                                if (!get_aim_dir(&dir)) return;
@@ -6002,7 +6002,7 @@ msg_print("
                                fire_ball(GF_FIRE, dir, 200, -2);
                                if (o_ptr->sval == SV_RING_FLAMES)
                                {
-                                       (void)set_oppose_fire(randint(20) + 20, FALSE);
+                                       (void)set_oppose_fire(randint1(20) + 20, FALSE);
                                        o_ptr->timeout = 200;
                                }
                                else o_ptr->timeout = 250;
@@ -6012,7 +6012,7 @@ msg_print("
                                fire_ball(GF_COLD, dir, 200, -2);
                                if (o_ptr->sval == SV_RING_ICE)
                                {
-                                       (void)set_oppose_cold(randint(20) + 20, FALSE);
+                                       (void)set_oppose_cold(randint1(20) + 20, FALSE);
                                        o_ptr->timeout = 200;
                                }
                                else o_ptr->timeout = 250;
@@ -6023,12 +6023,12 @@ msg_print("
                                o_ptr->timeout = 150;
                                break;
                        case EGO_RING_D_SPEED:
-                               (void)set_fast(randint(30) + 15, FALSE);
+                               (void)set_fast(randint1(30) + 15, FALSE);
                                o_ptr->timeout = 100;
                                break;
                        case EGO_RING_BERSERKER:
-                               (void)set_shero(randint(25) + 25, FALSE);
-                               o_ptr->timeout = rand_int(75)+75;
+                               (void)set_shero(randint1(25) + 25, FALSE);
+                               o_ptr->timeout = randint0(75)+75;
                                break;
                        case EGO_RING_TELE_AWAY:
                                if (!get_aim_dir(&dir)) return;
@@ -6037,7 +6037,7 @@ msg_print("
                                break;
                        case EGO_RING_TRUE:
                        {
-                               int v = randint(25)+25;
+                               int v = randint1(25)+25;
                                (void)set_afraid(0);
                                (void)set_hero(v, FALSE);
                                (void)hp_player(10);
@@ -6066,32 +6066,32 @@ msg_print("
                        case SV_RING_ACID:
                        {
                                fire_ball(GF_ACID, dir, 100, 2);
-                               (void)set_oppose_acid(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        }
 
                        case SV_RING_ICE:
                        {
                                fire_ball(GF_COLD, dir, 100, 2);
-                               (void)set_oppose_cold(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        }
 
                        case SV_RING_FLAMES:
                        {
                                fire_ball(GF_FIRE, dir, 100, 2);
-                               (void)set_oppose_fire(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        }
 
                        case SV_RING_ELEC:
                        {
                                fire_ball(GF_ELEC, dir, 100, 2);
-                               (void)set_oppose_elec(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        }
                }
@@ -6120,35 +6120,35 @@ msg_print("
                                break;
                        case EGO_AMU_JUMP:
                                teleport_player(10);
-                               o_ptr->timeout = rand_int(10) + 10;
+                               o_ptr->timeout = randint0(10) + 10;
                                break;
                        case EGO_AMU_TELEPORT:
                                teleport_player(100);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_D_DOOR:
                                (void)dimension_door();
                                o_ptr->timeout = 200;
                                break;
                        case EGO_AMU_RES_FIRE_:
-                               (void)set_oppose_fire(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_RES_COLD_:
-                               (void)set_oppose_cold(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_RES_ELEC_:
-                               (void)set_oppose_elec(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_elec(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_RES_ACID_:
-                               (void)set_oppose_acid(randint(20) + 20, FALSE);
-                               o_ptr->timeout = rand_int(50) + 50;
+                               (void)set_oppose_acid(randint1(20) + 20, FALSE);
+                               o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_DETECTION:
                                detect_all(DETECT_RAD_DEFAULT);
-                               o_ptr->timeout = rand_int(55)+55;
+                               o_ptr->timeout = randint0(55)+55;
                                break;
                        }
                }
@@ -6201,7 +6201,7 @@ msg_print("
                        /* Free the "who" array */
                        C_KILL(who, max_m_idx, u16b);
                }
-               o_ptr->timeout = 100+randint(100);
+               o_ptr->timeout = 100+randint1(100);
                return;
        }
        else if (o_ptr->tval == TV_CAPTURE)
@@ -7085,7 +7085,7 @@ msg_print("
        if(p_ptr->dec_mana) chance--;
        if (p_ptr->heavy_spell) chance += 5;
 
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 
@@ -7096,7 +7096,7 @@ msg_print("
 #endif
 
                sound(SOUND_FAIL);
-               if (randint(100) >= chance)
+               if (randint1(100) >= chance)
                        chg_virtue(V_CHANCE,-1);
                energy_use = 100;
 
@@ -7121,7 +7121,7 @@ msg_print("
                        staff_effect(sval, &use_charge, TRUE);
                        if (!use_charge) return;
                }
-               if (randint(100) < chance)
+               if (randint1(100) < chance)
                        chg_virtue(V_CHANCE,1);
        }
        energy_use = 100;
index 399b59a..596bc39 100644 (file)
@@ -110,7 +110,7 @@ static void sense_inventory_aux(int slot, bool heavy)
        if (!feel) return;
 
        /* Bad luck */
-       if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !rand_int(13))
+       if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
        {
                switch (feel)
                {
@@ -126,17 +126,17 @@ static void sense_inventory_aux(int slot, bool heavy)
                        }
                        case FEEL_CURSED:
                        {
-                               feel = rand_int(3) ? FEEL_GOOD : FEEL_AVERAGE;
+                               feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
                                break;
                        }
                        case FEEL_AVERAGE:
                        {
-                               feel = rand_int(2) ? FEEL_CURSED : FEEL_GOOD;
+                               feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
                                break;
                        }
                        case FEEL_GOOD:
                        {
-                               feel = rand_int(3) ? FEEL_CURSED : FEEL_AVERAGE;
+                               feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
                                break;
                        }
                        case FEEL_EXCELLENT:
@@ -235,7 +235,7 @@ static void sense_inventory1(void)
                case CLASS_CAVALRY:
                {
                        /* Good sensing */
-                       if (0 != rand_int(9000L / (plev * plev + 40))) return;
+                       if (0 != randint0(9000L / (plev * plev + 40))) return;
 
                        /* Heavy sensing */
                        heavy = TRUE;
@@ -247,7 +247,7 @@ static void sense_inventory1(void)
                case CLASS_SMITH:
                {
                        /* Good sensing */
-                       if (0 != rand_int(6000L / (plev * plev + 50))) return;
+                       if (0 != randint0(6000L / (plev * plev + 50))) return;
 
                        /* Heavy sensing */
                        heavy = TRUE;
@@ -262,7 +262,7 @@ static void sense_inventory1(void)
                case CLASS_MAGIC_EATER:
                {
                        /* Very bad (light) sensing */
-                       if (0 != rand_int(240000L / (plev + 5))) return;
+                       if (0 != randint0(240000L / (plev + 5))) return;
 
                        /* Done */
                        break;
@@ -272,7 +272,7 @@ static void sense_inventory1(void)
                case CLASS_BARD:
                {
                        /* Good (light) sensing */
-                       if (0 != rand_int(10000L / (plev * plev + 40))) return;
+                       if (0 != randint0(10000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -282,7 +282,7 @@ static void sense_inventory1(void)
                case CLASS_NINJA:
                {
                        /* Okay sensing */
-                       if (0 != rand_int(20000L / (plev * plev + 40))) return;
+                       if (0 != randint0(20000L / (plev * plev + 40))) return;
 
                        /* Heavy sensing */
                        heavy = TRUE;
@@ -294,7 +294,7 @@ static void sense_inventory1(void)
                case CLASS_RANGER:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(95000L / (plev * plev + 40))) return;
+                       if (0 != randint0(95000L / (plev * plev + 40))) return;
 
                        /* Changed! */
                        heavy = TRUE;
@@ -306,7 +306,7 @@ static void sense_inventory1(void)
                case CLASS_PALADIN:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(77777L / (plev * plev + 40))) return;
+                       if (0 != randint0(77777L / (plev * plev + 40))) return;
 
                        /* Heavy sensing */
                        heavy = TRUE;
@@ -319,7 +319,7 @@ static void sense_inventory1(void)
                case CLASS_RED_MAGE:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(75000L / (plev * plev + 40))) return;
+                       if (0 != randint0(75000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -329,7 +329,7 @@ static void sense_inventory1(void)
                case CLASS_MIRROR_MASTER:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(55000L / (plev * plev + 40))) return;
+                       if (0 != randint0(55000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -338,7 +338,7 @@ static void sense_inventory1(void)
                case CLASS_CHAOS_WARRIOR:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(80000L / (plev * plev + 40))) return;
+                       if (0 != randint0(80000L / (plev * plev + 40))) return;
 
                        /* Changed! */
                        heavy = TRUE;
@@ -351,7 +351,7 @@ static void sense_inventory1(void)
                case CLASS_FORCETRAINER:
                {
                        /* Okay sensing */
-                       if (0 != rand_int(20000L / (plev * plev + 40))) return;
+                       if (0 != randint0(20000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -360,7 +360,7 @@ static void sense_inventory1(void)
                case CLASS_TOURIST:
                {
                        /* Good sensing */
-                       if (0 != rand_int(20000L / ((plev+50)*(plev+50)))) return;
+                       if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
 
                        /* Heavy sensing */
                        heavy = TRUE;
@@ -373,7 +373,7 @@ static void sense_inventory1(void)
                case CLASS_BLUE_MAGE:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(55000L / (plev * plev + 40))) return;
+                       if (0 != randint0(55000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -382,7 +382,7 @@ static void sense_inventory1(void)
                case CLASS_BEASTMASTER:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(65000L / (plev * plev + 40))) return;
+                       if (0 != randint0(65000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -441,10 +441,10 @@ static void sense_inventory1(void)
                if (!okay) continue;
 
                /* Occasional failure on inventory items */
-               if ((i < INVEN_RARM) && (0 != rand_int(5))) continue;
+               if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
 
                /* Good luck */
-               if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !rand_int(13))
+               if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
                {
                        heavy = TRUE;
                }
@@ -486,7 +486,7 @@ static void sense_inventory2(void)
                case CLASS_NINJA:
                {
                        /* Very bad (light) sensing */
-                       if (0 != rand_int(240000L / (plev + 5))) return;
+                       if (0 != randint0(240000L / (plev + 5))) return;
 
                        /* Done */
                        break;
@@ -498,7 +498,7 @@ static void sense_inventory2(void)
                case CLASS_MONK:
                {
                        /* Bad sensing */
-                       if (0 != rand_int(95000L / (plev * plev + 40))) return;
+                       if (0 != randint0(95000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -511,7 +511,7 @@ static void sense_inventory2(void)
                case CLASS_MINDCRAFTER:
                {
                        /* Good sensing */
-                       if (0 != rand_int(20000L / (plev * plev + 40))) return;
+                       if (0 != randint0(20000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -525,7 +525,7 @@ static void sense_inventory2(void)
                case CLASS_BLUE_MAGE:
                {
                        /* Good sensing */
-                       if (0 != rand_int(9000L / (plev * plev + 40))) return;
+                       if (0 != randint0(9000L / (plev * plev + 40))) return;
 
                        /* Done */
                        break;
@@ -534,7 +534,7 @@ static void sense_inventory2(void)
                case CLASS_TOURIST:
                {
                        /* Good sensing */
-                       if (0 != rand_int(20000L / ((plev+50)*(plev+50)))) return;
+                       if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
 
                        /* Done */
                        break;
@@ -570,7 +570,7 @@ static void sense_inventory2(void)
                if (!okay) continue;
 
                /* Occasional failure on inventory items */
-               if ((i < INVEN_RARM) && (0 != rand_int(5))) continue;
+               if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
 
                sense_inventory_aux(i, TRUE);
        }
@@ -694,7 +694,7 @@ take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "
 #endif
 
 
-       to_ruin = randint(45) + 35;
+       to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
        {
@@ -1230,7 +1230,7 @@ static void gere_music(s32b music)
                         project_hack(GF_TURN_ALL, p_ptr->lev);
                         break;
                 case MUSIC_PSI:
-                        project_hack(GF_PSI, randint(p_ptr->lev * 3 / 2));
+                        project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
                         break;
                 case MUSIC_ID:
                         project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
@@ -1249,8 +1249,8 @@ static void gere_music(s32b music)
                                0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
                         break;
                 case MUSIC_DISPEL:
-                        dispel_monsters(randint(p_ptr->lev * 3));
-                        dispel_evil(randint(p_ptr->lev * 3));
+                        dispel_monsters(randint1(p_ptr->lev * 3));
+                        dispel_evil(randint1(p_ptr->lev * 3));
                         break;
                 case MUSIC_SARUMAN:
                         slow_monsters();
@@ -1263,7 +1263,7 @@ static void gere_music(s32b music)
                         stasis_monsters(p_ptr->lev * 4);
                         break;
                 case MUSIC_SHERO:
-                        dispel_monsters(randint(p_ptr->lev * 3));
+                        dispel_monsters(randint1(p_ptr->lev * 3));
                         break;
                 case MUSIC_H_LIFE:
                         hp_player(damroll(15,10));
@@ -1796,13 +1796,13 @@ sprintf(ouch, "%s
        if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
                !p_ptr->invuln && !p_ptr->immune_fire && !p_ptr->ffall)
        {
-               int damage = 3000 + rand_int(2000);
+               int damage = 3000 + randint0(2000);
 
                if (prace_is_(RACE_ENT)) damage += damage/3;
 
                if (p_ptr->resist_fire) damage = damage / 3;
                if (p_ptr->oppose_fire) damage = damage / 3;
-               damage = damage / 100 + (rand_int(100) < (damage % 100));
+               damage = damage / 100 + (randint0(100) < (damage % 100));
 
                if (damage)
                {
@@ -1822,7 +1822,7 @@ take_hit(DAMAGE_NOESCAPE, damage, "
        else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
                !p_ptr->invuln && !p_ptr->immune_fire)
        {
-               int damage = 6000 + rand_int(4000);
+               int damage = 6000 + randint0(4000);
 
                cptr message;
                cptr hit_from;
@@ -1855,7 +1855,7 @@ hit_from = "
 
                }
 
-               damage = damage / 100 + (rand_int(100) < (damage % 100));
+               damage = damage / 100 + (randint0(100) < (damage % 100));
                if (damage)
                {
                        /* Take damage */
@@ -1873,10 +1873,10 @@ hit_from = "
                        /* Take damage */
 #ifdef JP
 msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
-take_hit(DAMAGE_NOESCAPE, randint(p_ptr->lev), "Å®¤ì", -1);
+take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
 #else
                        msg_print("You are drowning!");
-                       take_hit(DAMAGE_NOESCAPE, randint(p_ptr->lev), "drowning", -1);
+                       take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
 #endif
 
                        cave_no_regen = TRUE;
@@ -2216,7 +2216,7 @@ if (!p_ptr->invuln) take_hit(DAMAGE_LOSELIFE, i, "
                if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
                {
                        /* Faint occasionally */
-                       if (!p_ptr->paralyzed && (rand_int(100) < 10))
+                       if (!p_ptr->paralyzed && (randint0(100) < 10))
                        {
                                /* Message */
 #ifdef JP
@@ -2228,7 +2228,7 @@ msg_print("
                                disturb(1, 0);
 
                                /* Hack -- faint (bypass free action) */
-                               (void)set_paralyzed(p_ptr->paralyzed + 1 + rand_int(5));
+                               (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
                        }
                }
        }
@@ -2673,10 +2673,10 @@ msg_print("
                        msg_print("You feel a fit of rage coming over you!");
 #endif
 
-                       (void)set_shero(10 + randint(p_ptr->lev), FALSE);
+                       (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
                }
 
-               if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint(3000) == 13))
+               if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
                {
                        if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
                        {
@@ -2687,11 +2687,11 @@ msg_print("
                                msg_print("It's so dark... so scary!");
 #endif
 
-                               set_afraid(p_ptr->afraid + 13 + randint(26));
+                               set_afraid(p_ptr->afraid + 13 + randint1(26));
                        }
                }
 
-               if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint(5000) == 88))
+               if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
                {
                        if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
                            !p_ptr->anti_tele)
@@ -2710,7 +2710,7 @@ msg_print("
                        }
                }
 
-               if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint(6400) == 321))
+               if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
                {
                        if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
                        {
@@ -2726,7 +2726,7 @@ msg_print("
 
                        if (!p_ptr->resist_conf)
                        {
-                               (void)set_confused(p_ptr->confused + rand_int(20) + 15);
+                               (void)set_confused(p_ptr->confused + randint0(20) + 15);
                        }
 
                        if (!p_ptr->resist_chaos)
@@ -2757,23 +2757,23 @@ msg_print("
                                                msg_print("Thishcischs GooDSChtuff!");
 #endif
 
-                                               (void)set_image(p_ptr->image + rand_int(150) + 150);
+                                               (void)set_image(p_ptr->image + randint0(150) + 150);
                                        }
                                }
                        }
                }
 
-               if ((p_ptr->muta2 & MUT2_HALLU) && (randint(6400) == 42))
+               if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
                {
                        if (!p_ptr->resist_chaos)
                        {
                                disturb(0, 0);
                                p_ptr->redraw |= PR_EXTRA;
-                               (void)set_image(p_ptr->image + rand_int(50) + 20);
+                               (void)set_image(p_ptr->image + randint0(50) + 20);
                        }
                }
 
-               if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint(3000) == 13))
+               if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
                {
                        disturb(0, 0);
 
@@ -2805,7 +2805,7 @@ msg_print("
                }
 
                if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
-                   !p_ptr->anti_magic && (randint(6666) == 666))
+                   !p_ptr->anti_magic && (randint1(6666) == 666))
                {
                        bool pet = one_in_(6);
                        bool not_pet = (bool)(!pet);
@@ -2840,7 +2840,7 @@ msg_print("
                                }
                                else
                                {
-                                       set_slow(randint(30) + 10, FALSE);
+                                       set_slow(randint1(30) + 10, FALSE);
                                }
                        }
                        else
@@ -2857,7 +2857,7 @@ msg_print("
                                }
                                else
                                {
-                                       set_fast(randint(30) + 10, FALSE);
+                                       set_fast(randint1(30) + 10, FALSE);
                                }
                        }
                        msg_print(NULL);
@@ -2880,7 +2880,7 @@ msg_print("Ź
                                msg_print("You see one of the shopkeepers running for the hills!");
 #endif
 
-                               store_shuffle(rand_int(MAX_STORES));
+                               store_shuffle(randint0(MAX_STORES));
                        }
                        msg_print(NULL);
                }
@@ -2988,7 +2988,7 @@ msg_print("
 #endif
 
                        msg_print(NULL);
-                       set_wraith_form(randint(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
+                       set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
                }
                if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
                {
@@ -2996,7 +2996,7 @@ msg_print("
                }
                if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
                {
-                       int which_stat = rand_int(6);
+                       int which_stat = randint0(6);
                        int sustained = FALSE;
 
                        switch (which_stat)
@@ -3039,7 +3039,7 @@ msg_print("
 #endif
 
                                msg_print(NULL);
-                               (void)dec_stat(which_stat, randint(6) + 6, one_in_(3));
+                               (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
                        }
                }
                if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
@@ -3177,7 +3177,7 @@ msg_print("̵Ũ
 #endif
 
                        msg_print(NULL);
-                       (void)set_invuln(randint(8) + 8, FALSE);
+                       (void)set_invuln(randint1(8) + 8, FALSE);
                }
                if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
                {
@@ -3226,10 +3226,10 @@ take_hit(DAMAGE_LOSELIFE, healing, "Ƭ
                        disturb(0, 0);
 #ifdef JP
 msg_print("­¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
-take_hit(DAMAGE_NOESCAPE, randint(p_ptr->wt / 6), "žÅÝ", -1);
+take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
 #else
                        msg_print("You trip over your own feet!");
-                       take_hit(DAMAGE_NOESCAPE, randint(p_ptr->wt / 6), "tripping", -1);
+                       take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
 #endif
 
 
@@ -3263,7 +3263,7 @@ msg_print("
        /* Handle experience draining */
        if (p_ptr->exp_drain)
        {
-               if (rand_int(100) < 25)
+               if (randint0(100) < 25)
                {
                        p_ptr->exp -= (p_ptr->lev+1)/2;
                        if (p_ptr->exp < 0) p_ptr->exp = 0;
@@ -3330,7 +3330,7 @@ if (!get_rnd_line("chainswd_j.txt", 0, noise))
                         * Hack: Uncursed teleporting items (e.g. Trump Weapons)
                         * can actually be useful!
                         */
-                       if ((f3 & TR3_TELEPORT) && (rand_int(100) < 1))
+                       if ((f3 & TR3_TELEPORT) && (randint0(100) < 1))
                        {
                                if ((o_ptr->ident & IDENT_CURSED) && !p_ptr->anti_tele)
                                {
@@ -3538,7 +3538,7 @@ msg_print("
                                if (dun_level < 1) dun_level = 1;
 
                                /* Nightmare mode makes recall more dangerous */
-                               if (ironman_nightmare && !rand_int(666) && (dungeon_type == DUNGEON_ANGBAND))
+                               if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
                                {
                                        if (dun_level < 50)
                                        {
@@ -4773,7 +4773,7 @@ msg_print("
        }
 
        /* Give the player some energy */
-       else if((rand_int(60) < ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]))) && !(load && p_ptr->energy >= 100))
+       else if((randint0(60) < ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]))) && !(load && p_ptr->energy >= 100))
                p_ptr->energy += gain_energy();
 
        /* No turn yet */
@@ -4909,7 +4909,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->stunned;
@@ -4949,7 +4949,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->confused;
@@ -4989,7 +4989,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->monfear;
@@ -6125,10 +6125,10 @@ quit("
                write_level = TRUE;
 
                /* Hack -- seed for flavors */
-               seed_flavor = rand_int(0x10000000);
+               seed_flavor = randint0(0x10000000);
 
                /* Hack -- seed for town layout */
-               seed_town = rand_int(0x10000000);
+               seed_town = randint0(0x10000000);
 
                /* Roll up a new character */
                player_birth();
index 0c6f61a..5b578cd 100644 (file)
@@ -3326,7 +3326,7 @@ msg_print("Ƭ
                        break;
                }
 
-               if (randint(1000) < v || one_in_(16))
+               if (randint1(1000) < v || one_in_(16))
                {
 #ifdef JP
 msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
@@ -3610,7 +3610,7 @@ msg_print("
                /* Notice */
                notice = TRUE;
 
-               if (randint(1000) < v || one_in_(16))
+               if (randint1(1000) < v || one_in_(16))
                {
                        if (!p_ptr->sustain_chr)
                        {
@@ -3957,7 +3957,7 @@ bool inc_stat(int stat)
                /* Gain one (sometimes two) points */
                if (value < 18)
                {
-                       gain = ((rand_int(100) < 75) ? 1 : 2);
+                       gain = ((randint0(100) < 75) ? 1 : 2);
                        value += gain;
                }
 
@@ -3971,7 +3971,7 @@ bool inc_stat(int stat)
                        if (gain < 1) gain = 1;
 
                        /* Apply the bonus */
-                       value += randint(gain) + gain / 2;
+                       value += randint1(gain) + gain / 2;
 
                        /* Maximal value */
                        if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
@@ -4053,7 +4053,7 @@ bool dec_stat(int stat, int amount, int permanent)
                        if (loss < 1) loss = 1;
 
                        /* Randomize the loss */
-                       loss = ((randint(loss) + loss) * amount) / 100;
+                       loss = ((randint1(loss) + loss) * amount) / 100;
 
                        /* Maximal loss */
                        if (loss < amount/2) loss = amount/2;
@@ -4095,7 +4095,7 @@ bool dec_stat(int stat, int amount, int permanent)
                        /* and one-half of the stat bonus times the percentage, with a */
                        /* minimum damage of half the percentage. -CWS */
                        loss = (((max-18) / 2 + 1) / 2 + 1);
-                       loss = ((randint(loss) + loss) * amount) / 100;
+                       loss = ((randint1(loss) + loss) * amount) / 100;
                        if (loss < amount/2) loss = amount/2;
 
                        /* Lose some points */
@@ -4323,7 +4323,7 @@ bool do_dec_stat(int stat)
        }
 
        /* Sustain */
-       if (sust && (!ironman_nightmare || rand_int(13)))
+       if (sust && (!ironman_nightmare || randint0(13)))
        {
                /* Message */
 #ifdef JP
@@ -4339,7 +4339,7 @@ msg_format("%s
        }
 
        /* Attempt to reduce the stat */
-       if (dec_stat(stat, 10, (ironman_nightmare && !rand_int(13))))
+       if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
        {
                /* Message */
 #ifdef JP
@@ -4571,7 +4571,7 @@ msg_print("
 
        chg_virtue(V_CHANCE, 1);
 
-       if ((power > rand_int(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
+       if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
        {
                char effect_msg[80] = "";
                int new_race, expfact, goalexpfact, h_percent;
@@ -4579,7 +4579,7 @@ msg_print("
                /* Some form of racial polymorph... */
                power -= 10;
 
-               if ((power > rand_int(5)) && one_in_(4))
+               if ((power > randint0(5)) && one_in_(4))
                {
                        /* sex change */
                        power -= 2;
@@ -4608,7 +4608,7 @@ sprintf(effect_msg, "
                        }
                }
 
-               if ((power > rand_int(30)) && one_in_(5))
+               if ((power > randint0(30)) && one_in_(5))
                {
                        int tmp = 0;
 
@@ -4619,14 +4619,14 @@ sprintf(effect_msg, "
                        {
                                if (one_in_(2))
                                {
-                                       (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
+                                       (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
                                        power -= 1;
                                }
                                tmp++;
                        }
 
                        /* Deformities are discriminated against! */
-                       (void)dec_stat(A_CHR, randint(6), TRUE);
+                       (void)dec_stat(A_CHR, randint1(6), TRUE);
 
                        if (effect_msg[0])
                        {
@@ -4651,7 +4651,7 @@ sprintf(effect_msg, "
                        }
                }
 
-               while ((power > rand_int(20)) && one_in_(10))
+               while ((power > randint0(20)) && one_in_(10))
                {
                        /* Polymorph into a less mutated form */
                        power -= 10;
@@ -4672,11 +4672,11 @@ msg_print("
                if (power < 0)
                        goalexpfact = 100;
                else
-                       goalexpfact = 100 + 3 * rand_int(power);
+                       goalexpfact = 100 + 3 * randint0(power);
 
                do
                {
-                       new_race = rand_int(MAX_RACES);
+                       new_race = randint0(MAX_RACES);
                        expfact = race_info[new_race].r_exp;
                }
                while (((new_race == p_ptr->prace) && (expfact > goalexpfact)) || (new_race == RACE_ANDROID));
@@ -4755,7 +4755,7 @@ msg_print("
                lite_spot(py, px);
        }
 
-       if ((power > rand_int(30)) && one_in_(6))
+       if ((power > randint0(30)) && one_in_(6))
        {
                int tmp = 0;
 
@@ -4770,24 +4770,24 @@ msg_format("%s
 
                while (tmp < 6)
                {
-                       (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
+                       (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
                        tmp++;
                }
                if (one_in_(6))
                {
 #ifdef JP
 msg_print("¸½ºß»Ñ¤ÇÀ¸¤­¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
-take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
+take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
 #else
                        msg_print("You find living difficult in your present form!");
-                       take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "a lethal mutation", -1);
+                       take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "a lethal mutation", -1);
 #endif
 
                        power -= 10;
                }
        }
 
-       if ((power > rand_int(20)) && one_in_(4))
+       if ((power > randint0(20)) && one_in_(4))
        {
                power -= 10;
 
@@ -4795,13 +4795,13 @@ take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "
                do_cmd_rerate(FALSE);
        }
 
-       while ((power > rand_int(15)) && one_in_(3))
+       while ((power > randint0(15)) && one_in_(3))
        {
                power -= 7;
                (void)gain_random_mutation(0);
        }
 
-       if (power > rand_int(5))
+       if (power > randint0(5))
        {
                power -= 5;
                do_poly_wounds();
@@ -5102,7 +5102,7 @@ get_rnd_line("death_j.txt", 0, death_message);
 
                                  /* ºù»¶¤ë */
                                  for (i = 0; i < 40; i++) 
-                                   Term_putstr(rand_int(w / 2) * 2, rand_int(h), 2, TERM_VIOLET, "¦Ô");
+                                   Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "¦Ô");
 
                                  str = death_message;
                                  if (strncmp(str, "¡Ö", 2) == 0) str += 2;
@@ -5558,15 +5558,15 @@ bool choose_ele_attack(void)
        choice = inkey();
 
        if ((choice == 'a') || (choice == 'A')) 
-               set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
-               set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
-               set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
-               set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
-               set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint(p_ptr->lev/2));
+               set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
        else
        {
 #ifdef JP
index 18b8ce1..ca7e16d 100644 (file)
@@ -7046,7 +7046,7 @@ errr get_rnd_line(cptr file_name, int entry, char *output)
        if (numentries > 0)
        {
                /* Grab an appropriate line number */
-               line = rand_int(numentries);
+               line = randint0(numentries);
 
                /* Get the random line */
                for (counter = 0; counter <= line; counter++)
index 88bca3f..bf66e99 100644 (file)
@@ -504,19 +504,19 @@ void get_table_name(char *out_string)
        strcat(out_string, Syllable);
        strcat(out_string, "¡Ù");
 #else
-       int testcounter = randint(3) + 1;
+       int testcounter = randint1(3) + 1;
 
        strcpy(out_string, "'");
 
-       if (randint(3) == 2)
+       if (randint1(3) == 2)
        {
                while (testcounter--)
-                       strcat(out_string, syllables[rand_int(MAX_SYLLABLES)]);
+                       strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
        }
        else
        {
                char Syllable[80];
-               testcounter = randint(2) + 1;
+               testcounter = randint1(2) + 1;
                while (testcounter--)
                {
                        (void)get_rnd_line("elvish.txt", 0, Syllable);
@@ -594,7 +594,7 @@ void flavor_init(void)
        /* Rings have "ring colors" */
        for (i = 0; i < MAX_ROCKS; i++)
        {
-               j = rand_int(MAX_ROCKS);
+               j = randint0(MAX_ROCKS);
                temp_adj = ring_adj[i];
                ring_adj[i] = ring_adj[j];
                ring_adj[j] = temp_adj;
@@ -622,7 +622,7 @@ void flavor_init(void)
        /* Amulets have "amulet colors" */
        for (i = 0; i < MAX_AMULETS; i++)
        {
-               j = rand_int(MAX_AMULETS);
+               j = randint0(MAX_AMULETS);
                temp_adj = amulet_adj[i];
                amulet_adj[i] = amulet_adj[j];
                amulet_adj[j] = temp_adj;
@@ -635,7 +635,7 @@ void flavor_init(void)
        /* Staffs */
        for (i = 0; i < MAX_WOODS; i++)
        {
-               j = rand_int(MAX_WOODS);
+               j = randint0(MAX_WOODS);
                temp_adj = staff_adj[i];
                staff_adj[i] = staff_adj[j];
                staff_adj[j] = temp_adj;
@@ -648,7 +648,7 @@ void flavor_init(void)
        /* Wands */
        for (i = 0; i < MAX_METALS; i++)
        {
-               j = rand_int(MAX_METALS);
+               j = randint0(MAX_METALS);
                temp_adj = wand_adj[i];
                wand_adj[i] = wand_adj[j];
                wand_adj[j] = temp_adj;
@@ -661,7 +661,7 @@ void flavor_init(void)
        /* Rods */
        for (i = 0; i < MAX_METALS; i++)
        {
-               j = rand_int(MAX_METALS);
+               j = randint0(MAX_METALS);
                temp_adj = rod_adj[i];
                rod_adj[i] = rod_adj[j];
                rod_adj[j] = temp_adj;
@@ -674,7 +674,7 @@ void flavor_init(void)
        /* Foods (Mushrooms) */
        for (i = 0; i < MAX_SHROOM; i++)
        {
-               j = rand_int(MAX_SHROOM);
+               j = randint0(MAX_SHROOM);
                temp_adj = food_adj[i];
                food_adj[i] = food_adj[j];
                food_adj[j] = temp_adj;
@@ -687,7 +687,7 @@ void flavor_init(void)
        /* Potions */
        for (i = 4; i < MAX_COLORS; i++)
        {
-               j = rand_int(MAX_COLORS - 4) + 4;
+               j = randint0(MAX_COLORS - 4) + 4;
                temp_adj = potion_adj[i];
                potion_adj[i] = potion_adj[j];
                potion_adj[j] = temp_adj;
@@ -721,13 +721,13 @@ void flavor_init(void)
                                tmp[0] = '\0';
 
                                /* Choose one or two syllables */
-                               s = ((rand_int(100) < 30) ? 1 : 2);
+                               s = ((randint0(100) < 30) ? 1 : 2);
 
                                /* Add a one or two syllable word */
                                for (q = 0; q < s; q++)
                                {
                                        /* Add the syllable */
-                                       strcat(tmp, syllables[rand_int(MAX_SYLLABLES)]);
+                                       strcat(tmp, syllables[randint0(MAX_SYLLABLES)]);
                                }
 
                                /* Stop before getting too long */
index 9f67767..4ef6281 100644 (file)
@@ -133,7 +133,7 @@ static bool alloc_stairs(int feat, int num, int walls)
                if (ironman_downward || !dun_level) return TRUE;
 
                if (dun_level > d_info[dungeon_type].mindepth)
-                       more_num = (randint(num+1))/2;
+                       more_num = (randint1(num+1))/2;
        }
        else if (feat == FEAT_MORE)
        {
@@ -144,7 +144,7 @@ static bool alloc_stairs(int feat, int num, int walls)
                if (dun_level >= d_info[dungeon_type].maxdepth) return TRUE;
 
                if ((dun_level < d_info[dungeon_type].maxdepth-1) && !quest_number(dun_level+1))
-                       more_num = (randint(num)+1)/2;
+                       more_num = (randint1(num)+1)/2;
        }
 
        /* Place "num" stairs */
@@ -157,8 +157,8 @@ static bool alloc_stairs(int feat, int num, int walls)
                        for (j = 0; !flag && j <= 3000; j++)
                        {
                                /* Pick a random grid */
-                               y = randint(cur_hgt-2);
-                               x = randint(cur_wid-2);
+                               y = randint1(cur_hgt-2);
+                               x = randint1(cur_wid-2);
 
                                /* Access the grid */
                                c_ptr = &cave[y][x];
@@ -206,8 +206,8 @@ static void alloc_object(int set, int typ, int num)
                        dummy++;
 
                        /* Location */
-                       y = rand_int(cur_hgt);
-                       x = rand_int(cur_wid);
+                       y = randint0(cur_hgt);
+                       x = randint0(cur_wid);
 
                        c_ptr = &cave[y][x];
 
@@ -365,7 +365,7 @@ static void try_door(int y, int x)
        if (cave[y][x].info & (CAVE_ROOM)) return;
 
        /* Occasional door (if allowed) */
-       if ((rand_int(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
+       if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
        {
                /* Place a door */
                place_random_door(y, x);
@@ -486,7 +486,7 @@ msg_print("
                destroyed = TRUE;
 
                /* extra rubble around the place looks cool */
-               build_lake(3+rand_int(2));
+               build_lake(3+randint0(2));
        }
 
        /* Make a lake some of the time */
@@ -502,7 +502,7 @@ msg_print("
                if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA)
                {
                        /* Lake of Lava */
-                       if ((dun_level > 80) && (rand_int(count) < 2)) laketype = 1;
+                       if ((dun_level > 80) && (randint0(count) < 2)) laketype = 1;
                        count -= 2;
 
                        /* Lake of Lava2 */
@@ -513,7 +513,7 @@ msg_print("
                if ((d_info[dungeon_type].flags1 & DF1_LAKE_WATER) && !laketype)
                {
                        /* Lake of Water */
-                       if ((dun_level > 50) && rand_int(count) < 2) laketype = 2;
+                       if ((dun_level > 50) && randint0(count) < 2) laketype = 2;
                        count -= 2;
 
                        /* Lake of Water2 */
@@ -524,7 +524,7 @@ msg_print("
                if ((d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) && !laketype)
                {
                        /* Lake of rubble */
-                       if ((dun_level > 35) && (rand_int(count) < 2)) laketype = 3;
+                       if ((dun_level > 35) && (randint0(count) < 2)) laketype = 3;
                        count -= 2;
 
                        /* Lake of rubble2 */
@@ -550,7 +550,7 @@ msg_print("
 
        if ((dun_level > DUN_CAVERN) && !empty_level &&
            (d_info[dungeon_type].flags1 & DF1_CAVERN) &&
-           (laketype == 0) && !destroyed && (randint(1000) < dun_level))
+           (laketype == 0) && !destroyed && (randint1(1000) < dun_level))
        {
                cavern = TRUE;
 
@@ -601,8 +601,8 @@ msg_print("ƶ
                bool force_rooms = (ironman_rooms && !((d_info[dungeon_type].flags1 & DF1_BEGINNER) || (d_info[dungeon_type].flags1 & DF1_CHAMELEON)));
 
                /* Pick a block for the room */
-               y = rand_int(dun->row_rooms);
-               x = rand_int(dun->col_rooms);
+               y = randint0(dun->row_rooms);
+               x = randint0(dun->col_rooms);
 
                /* Align dungeon rooms */
                if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
@@ -615,19 +615,19 @@ msg_print("ƶ
                }
 
                /* Attempt an "unusual" room */
-               if (force_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
+               if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
                {
                        /* Roll for room type */
                        while(1)
                        {
-                               k = (force_rooms ? 0 : rand_int(100));
+                               k = (force_rooms ? 0 : randint0(100));
                                if (force_rooms) break;
                                if ((d_info[dungeon_type].flags1 & DF1_NO_VAULT) && (k < 14)) continue;
                                break;
                        }
 
                        /* Attempt a very unusual room */
-                       if (force_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
+                       if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
                        {
 #ifdef FORCE_V_IDX
                                if (room_build(y, x, 8)) continue;
@@ -705,7 +705,7 @@ if (cheat_room) msg_print("
                }
 
                /* The deeper you are, the more cavelike the rooms are */
-               k = randint(100);
+               k = randint1(100);
 
                /* No caves when a cavern exists: they look bad */
                if (((k < dun_level) || (d_info[dungeon_type].flags1 & DF1_CAVE)) && (!cavern) && (!empty_level) && (laketype == 0) && !(d_info[dungeon_type].flags1 & DF1_NO_CAVE))
@@ -725,7 +725,7 @@ if (cheat_room) msg_print("
        {
                while (one_in_(DUN_MOS_DEN))
                {
-                       place_trees(randint(cur_wid - 2), randint(cur_hgt - 2));
+                       place_trees(randint1(cur_wid - 2), randint1(cur_hgt - 2));
                }
        }
 
@@ -733,10 +733,10 @@ if (cheat_room) msg_print("
        if (destroyed) destroy_level();
 
        /* Hack -- Add some rivers */
-       if (one_in_(3) && (randint(dun_level) > 5) && terrain_streams)
+       if (one_in_(3) && (randint1(dun_level) > 5) && terrain_streams)
        {
                /* Choose water or lava */
-               if ((randint(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
+               if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
                {
                        feat1 = FEAT_DEEP_WATER;
                        feat2 = FEAT_SHAL_WATER;
@@ -815,8 +815,8 @@ if (cheat_room) msg_print("
        /* Hack -- Scramble the room order */
        for (i = 0; i < dun->cent_n; i++)
        {
-               int pick1 = rand_int(dun->cent_n);
-               int pick2 = rand_int(dun->cent_n);
+               int pick1 = randint0(dun->cent_n);
+               int pick2 = randint0(dun->cent_n);
                y1 = dun->cent[pick1].y;
                x1 = dun->cent[pick1].x;
                dun->cent[pick1].y = dun->cent[pick2].y;
@@ -841,7 +841,7 @@ if (cheat_room) msg_print("
                dun->wall_n = 0;
 
                /* Connect the room to the previous room */
-               if (randint(dun_level) > d_info[dungeon_type].tunnel_percent)
+               if (randint1(dun_level) > d_info[dungeon_type].tunnel_percent)
                {
                        /* make cave-like tunnel */
                        build_tunnel2(dun->cent[i].x, dun->cent[i].y, x, y, 2, 2);
@@ -884,7 +884,7 @@ if (cheat_room) msg_print("
                        place_floor_grid(c_ptr);
 
                        /* Occasional doorway */
-                       if ((rand_int(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
+                       if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
                        {
                                /* Place a random door */
                                place_random_door(y, x);
@@ -968,8 +968,8 @@ if (cheat_room) msg_print("
                                                /* Find an empty grid */
                                                while (TRUE)
                                                {
-                                                       y = rand_int(cur_hgt);
-                                                       x = rand_int(cur_wid);
+                                                       y = randint0(cur_hgt);
+                                                       x = randint0(cur_wid);
 
                                                        /* Access the grid */
                                                        c_ptr = &cave[y][x];
@@ -1031,7 +1031,7 @@ msg_format("
                }
        }
 
-       i += randint(8);
+       i += randint1(8);
 
        /* Put some monsters in the dungeon */
        for (i = i + k; i > 0; i--)
@@ -1040,10 +1040,10 @@ msg_format("
        }
 
        /* Place some traps in the dungeon */
-       alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint(k));
+       alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k));
 
        /* Put some rubble in corridors */
-       alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint(k));
+       alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
 
        /* Put some objects in rooms */
        alloc_object(ALLOC_SET_ROOM, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ROOM, 3));
@@ -1063,8 +1063,8 @@ msg_format("
                 while(try)
                 {
                         /* Get a random spot */
-                        oy = randint(cur_hgt - 4) + 2;
-                        ox = randint(cur_wid - 4) + 2;
+                        oy = randint1(cur_hgt - 4) + 2;
+                        ox = randint1(cur_wid - 4) + 2;
 
                         /* Is it a good spot ? */
                         if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[d_info[dungeon_type].final_guardian]))
@@ -1077,7 +1077,7 @@ msg_format("
                 }
        }
 
-       if ((empty_level && (!one_in_(DARK_EMPTY) || (randint(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+       if ((empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
        {
                /* Lite the cave */
                for (y = 0; y < cur_hgt; y++)
@@ -1381,8 +1381,8 @@ msg_print("
                {
                        do
                        {
-                               level_height = randint(MAX_HGT/SCREEN_HGT);
-                               level_width = randint(MAX_WID/SCREEN_WID);
+                               level_height = randint1(MAX_HGT/SCREEN_HGT);
+                               level_width = randint1(MAX_WID/SCREEN_WID);
                        }
                        while ((level_height == MAX_HGT/SCREEN_HGT) &&
                                   (level_width == MAX_WID/SCREEN_WID));
index 0bc3272..75420e6 100644 (file)
@@ -90,7 +90,7 @@ void place_random_stairs(int y, int x)
        if (down_stairs && up_stairs)
        {
                /* Choose a staircase randomly */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                        up_stairs = FALSE;
                else
                        down_stairs = FALSE;
@@ -118,7 +118,7 @@ void place_random_door(int y, int x)
        }
 
        /* Choose an object */
-       tmp = rand_int(1000);
+       tmp = randint0(1000);
 
        /* Open doors (300/1000) */
        if (tmp < 300)
@@ -160,7 +160,7 @@ void place_closed_door(int y, int x)
        }
 
        /* Choose an object */
-       tmp = rand_int(400);
+       tmp = randint0(400);
 
        /* Closed doors (300/400) */
        if (tmp < 300)
@@ -173,14 +173,14 @@ void place_closed_door(int y, int x)
        else if (tmp < 399)
        {
                /* Create locked door */
-               cave_set_feat(y, x, FEAT_DOOR_HEAD + randint(7));
+               cave_set_feat(y, x, FEAT_DOOR_HEAD + randint1(7));
        }
 
        /* Stuck doors (1/400) */
        else
        {
                /* Create jammed door */
-               cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + rand_int(8));
+               cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8));
        }
 }
 
@@ -276,7 +276,7 @@ msg_print("
                        if (!is_floor_grid(c_ptr) || c_ptr->o_idx) continue;
 
                        /* Place an item */
-                       if (rand_int(100) < 75)
+                       if (randint0(100) < 75)
                        {
                                place_object(j, k, FALSE, FALSE);
                        }
@@ -421,7 +421,7 @@ void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2)
        /* Never move diagonally */
        if (*rdir && *cdir)
        {
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                        *rdir = 0;
                else
                        *cdir = 0;
@@ -436,7 +436,7 @@ void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2)
 void rand_dir(int *rdir, int *cdir)
 {
        /* Pick a random direction */
-       int i = rand_int(4);
+       int i = randint0(4);
 
        /* Extract the dy/dx components */
        *rdir = ddy_ddd[i];
@@ -542,13 +542,13 @@ void build_tunnel(int row1, int col1, int row2, int col2)
                if (main_loop_count++ > 2000) break;
 
                /* Allow bends in the tunnel */
-               if (rand_int(100) < dun_tun_chg)
+               if (randint0(100) < dun_tun_chg)
                {
                        /* Acquire the correct direction */
                        correct_dir(&row_dir, &col_dir, row1, col1, row2, col2);
 
                        /* Random direction */
-                       if (rand_int(100) < dun_tun_rnd)
+                       if (randint0(100) < dun_tun_rnd)
                        {
                                rand_dir(&row_dir, &col_dir);
                        }
@@ -566,7 +566,7 @@ void build_tunnel(int row1, int col1, int row2, int col2)
                        correct_dir(&row_dir, &col_dir, row1, col1, row2, col2);
 
                        /* Random direction */
-                       if (rand_int(100) < dun_tun_rnd)
+                       if (randint0(100) < dun_tun_rnd)
                        {
                                rand_dir(&row_dir, &col_dir);
                        }
@@ -682,7 +682,7 @@ void build_tunnel(int row1, int col1, int row2, int col2)
                        }
 
                        /* Hack -- allow pre-emptive tunnel termination */
-                       if (rand_int(100) >= dun_tun_con)
+                       if (randint0(100) >= dun_tun_con)
                        {
                                /* Distance between row1 and start_row */
                                tmp_row = row1 - start_row;
@@ -791,8 +791,8 @@ static bool set_tunnel(int *x, int *y, bool affectwall)
                dx = 0;
                while ((i > 0) && is_solid_bold(*y + dy, *x + dx))
                {
-                       dy = rand_int(3) - 1;
-                       dx = rand_int(3) - 1;
+                       dy = randint0(3) - 1;
+                       dx = randint0(3) - 1;
 
                        if (!in_bounds(*y + dy, *x + dx))
                        {
@@ -1014,10 +1014,10 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
                dy = (y2 - y1) / 2;
 
                /* perturbation perpendicular to path */
-               changex = (rand_int(abs(dy) + 2) * 2 - abs(dy) - 1) / 2;
+               changex = (randint0(abs(dy) + 2) * 2 - abs(dy) - 1) / 2;
 
                /* perturbation perpendicular to path */
-               changey = (rand_int(abs(dx) + 2) * 2 - abs(dx) - 1) / 2;
+               changey = (randint0(abs(dx) + 2) * 2 - abs(dx) - 1) / 2;
 
                /* Work out "mid" ponit */
                x3 = x1 + dx + changex;
@@ -1042,8 +1042,8 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
                        dx = 0;
                        while ((i > 0) && is_solid_bold(y3 + dy, x3 + dx))
                        {
-                               dy = rand_int(3) - 1;
-                               dx = rand_int(3) - 1;
+                               dy = randint0(3) - 1;
+                               dx = randint0(3) - 1;
                                if (!in_bounds(y3 + dy, x3 + dx))
                                {
                                        dx = 0;
@@ -1069,7 +1069,7 @@ bool build_tunnel2(int x1, int y1, int x2, int y2, int type, int cutoff)
                {
                        if (build_tunnel2(x1, y1, x3, y3, type, cutoff))
                        {
-                               if ((cave[y3][x3].info & CAVE_ROOM) || (randint(100) > 95))
+                               if ((cave[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95))
                                {
                                        /* do second half only if works + if have hit a room */
                                        retval = build_tunnel2(x3, y3, x2, y2, type, cutoff);
index 457a217..86dc51d 100644 (file)
 
 #define place_floor_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,floor_type[rand_int(100)]); \
+  set_cave_feat(Y,X,floor_type[randint0(100)]); \
   cave[Y][X].info &= ~(CAVE_MASK); \
   add_cave_info(Y,X,CAVE_FLOOR); \
 }
 
 #define place_floor_grid(C) \
 { \
-  (C)->feat = floor_type[rand_int(100)]; \
+  (C)->feat = floor_type[randint0(100)]; \
   (C)->info &= ~(CAVE_MASK); \
   (C)->info |= CAVE_FLOOR; \
 }
 
 #define place_extra_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,fill_type[rand_int(100)]); \
+  set_cave_feat(Y,X,fill_type[randint0(100)]); \
   cave[Y][X].info &= ~(CAVE_MASK); \
   add_cave_info(Y,X,CAVE_EXTRA); \
 }
 
 #define place_extra_grid(C) \
 { \
-  (C)->feat = fill_type[rand_int(100)]; \
+  (C)->feat = fill_type[randint0(100)]; \
   (C)->info &= ~(CAVE_MASK); \
   (C)->info |= CAVE_EXTRA; \
 }
 
 #define place_extra_noperm_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,fill_type[rand_int(100)]); \
+  set_cave_feat(Y,X,fill_type[randint0(100)]); \
   if ((cave[Y][X].feat >= FEAT_PERM_EXTRA) && (cave[Y][X].feat <= FEAT_PERM_SOLID)) cave[Y][X].feat -= 0x04; \
   else if (cave[Y][X].feat == FEAT_MOUNTAIN) cave[Y][X].feat = feat_wall_inner; \
   cave[Y][X].info &= ~(CAVE_MASK); \
index 61b1607..8af4f78 100644 (file)
@@ -673,7 +673,7 @@ static bool cast_hissatsu_spell(int spell)
                cave[y][x].info &= ~(CAVE_MARK);
 
                /* Destroy the feature */
-               cave[y][x].feat = floor_type[rand_int(100)];
+               cave[y][x].feat = floor_type[randint0(100)];
                cave[y][x].info &= ~(CAVE_MASK);
                cave[y][x].info |= CAVE_FLOOR;
 
@@ -886,7 +886,7 @@ static bool cast_hissatsu_spell(int spell)
 #else
                msg_print("You roar out!");
 #endif
-               project_hack(GF_SOUND, randint(p_ptr->lev * 3));
+               project_hack(GF_SOUND, randint1(p_ptr->lev * 3));
                aggravate_monsters(0);
                break;
        }
@@ -1163,9 +1163,9 @@ msg_print("
                        return FALSE;
                }
 #ifdef JP
-               take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
+               take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
 #else
-               take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "reaction of your attack", -1); /*nanka*/
+               take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "reaction of your attack", -1); /*nanka*/
 #endif
                break;
        }
index 48e96b8..e673dc1 100644 (file)
@@ -3305,7 +3305,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                 * Random trap and random treasure defined
                                 * 25% chance for trap and 75% chance for object
                                 */
-                               if (rand_int(100) < 75)
+                               if (randint0(100) < 75)
                                {
                                        place_object(*y, *x, FALSE, FALSE);
                                }
@@ -3321,9 +3321,9 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                object_level = base_level + object_index;
 
                                /* Create an out of deep object */
-                               if (rand_int(100) < 75)
+                               if (randint0(100) < 75)
                                        place_object(*y, *x, FALSE, FALSE);
-                               else if (rand_int(100) < 80)
+                               else if (randint0(100) < 80)
                                        place_object(*y, *x, TRUE, FALSE);
                                else
                                        place_object(*y, *x, TRUE, TRUE);
index cec4bcd..4ff5cfe 100644 (file)
@@ -2372,7 +2372,7 @@ if (arg_fiddle) note("
        {
                for (j = 0; j < max_wild_y; j++)
                {
-                       wilderness[j][i].seed = rand_int(0x10000000);
+                       wilderness[j][i].seed = randint0(0x10000000);
                }
        }
 
@@ -2459,7 +2459,7 @@ note(format("
                                                         * Random monster 5 - 10 levels out of depth
                                                         * (depending on level)
                                                         */
-                                                       r_idx = get_mon_num(quest[i].level + 5 + randint(quest[i].level / 10));
+                                                       r_idx = get_mon_num(quest[i].level + 5 + randint1(quest[i].level / 10));
                                                        r_ptr = &r_info[r_idx];
 
                                                        if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
index 6291095..cba0328 100644 (file)
@@ -689,7 +689,7 @@ static errr Term_xtra_dos(int n, int v)
                                        /* Get a *new* song at random */
                                        while (1)
                                        {
-                                               n = randint(song_number);
+                                               n = randint1(song_number);
                                                if (n != current_song) break;
                                        }
                                        current_song = n;
@@ -2000,7 +2000,7 @@ static errr Term_xtra_dos_sound(int v)
        if ((v < 0) || (v >= SOUND_MAX)) return (1);
 
        /* Get a random sample from the available ones */
-       n = rand_int(sample_count[v]);
+       n = randint0(sample_count[v]);
 
        /* Play the sound, catch errors */
        if (samples[v][n])
index 25f7d49..9cfa440 100644 (file)
@@ -295,7 +295,7 @@ static bool use_mane(int spell)
        int             dir;
        int             plev = p_ptr->lev;
        bool    unique_okay = FALSE;
-       if (randint(50+plev) < plev/10) unique_okay = TRUE;
+       if (randint1(50+plev) < plev/10) unique_okay = TRUE;
 
 
        /* spell code */
@@ -718,7 +718,7 @@ else msg_print("
                break;
        case MS_DRAIN_MANA:
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball_hide(GF_DRAIN_MANA, dir, randint(plev*3)+plev, 0);
+               fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
                break;
        case MS_MIND_BLAST:
                if (!get_aim_dir(&dir)) return FALSE;
@@ -887,7 +887,7 @@ else msg_print("Ͷ
                sleep_monster(dir);
                break;
        case MS_SPEED:
-               (void)set_fast(randint(20 + plev) + plev, FALSE);
+               (void)set_fast(randint1(20 + plev) + plev, FALSE);
                break;
        case MS_HAND_DOOM:
        {
@@ -917,7 +917,7 @@ msg_print("̵
 #else
                        msg_print("You casts a Globe of Invulnerability.");
 #endif
-               (void)set_invuln(randint(7) + 7, FALSE);
+               (void)set_invuln(randint1(7) + 7, FALSE);
                break;
        case MS_BLINK:
                teleport_player(10);
@@ -943,7 +943,7 @@ msg_print("̵
                        msg_print("hek!");
                msg_print(NULL);
 
-               p_ptr->energy += (randint(200)+1200);
+               p_ptr->energy += (randint1(200)+1200);
 
                /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
@@ -1000,7 +1000,7 @@ msg_format("%s
                        msg_format("You gestures at %s's feet.", m_name);
 #endif
 
-               if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint(50) > plev + randint(60)))
+               if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
                {
 #ifdef JP
 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
@@ -1090,7 +1090,7 @@ msg_print("
        case MS_S_CYBER:
        {
                int k;
-               int max_cyber = (dun_level / 50) + randint(3);
+               int max_cyber = (dun_level / 50) + randint1(3);
                if (!target_set(TARGET_KILL)) return FALSE;
 #ifdef JP
 msg_print("¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª");
@@ -1364,7 +1364,7 @@ msg_print("
        if (chance > 95) chance = 95;
 
        /* Failed spell */
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 #ifdef JP
index f03210f..e092dcc 100644 (file)
@@ -28,7 +28,7 @@ static int monster_critical(int dice, int sides, int dam)
        if (dam < total * 19 / 20) return (0);
 
        /* Weak blows rarely work */
-       if ((dam < 20) && (rand_int(100) >= dam)) return (0);
+       if ((dam < 20) && (randint0(100) >= dam)) return (0);
 
        /* Perfect damage */
        if (dam == total && dam >= 40) max++;
@@ -36,7 +36,7 @@ static int monster_critical(int dice, int sides, int dam)
        /* Super-charge */
        if (dam >= 20)
        {
-               while (rand_int(100) < 2) max++;
+               while (randint0(100) < 2) max++;
        }
 
        /* Critical damage */
@@ -62,7 +62,7 @@ static int check_hit(int power, int level, int stun)
        int i, k, ac;
 
        /* Percentile dice */
-       k = rand_int(100);
+       k = randint0(100);
 
        if (stun && one_in_(2)) return FALSE;
 
@@ -77,7 +77,7 @@ static int check_hit(int power, int level, int stun)
        if (p_ptr->special_attack & ATTACK_SUIKEN) ac += (p_ptr->lev * 2);
 
        /* Power and Level compete against Armor */
-       if ((i > 0) && (randint(i) > ((ac * 3) / 4))) return (TRUE);
+       if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
 
        /* Assume miss */
        return (FALSE);
@@ -202,7 +202,7 @@ bool make_attack_normal(int m_idx)
                if (py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
        }
 
-       if ((p_ptr->special_defense & NINJA_KAWARIMI) && (rand_int(55) < (p_ptr->lev*3/5+20)))
+       if ((p_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (p_ptr->lev*3/5+20)))
        {
                kawarimi(TRUE);
                return TRUE;
@@ -300,7 +300,7 @@ bool make_attack_normal(int m_idx)
                        if ((p_ptr->protevil > 0) &&
                            (r_ptr->flags3 & RF3_EVIL) &&
                            (p_ptr->lev >= rlev) &&
-                           ((rand_int(100) + p_ptr->lev) > 50))
+                           ((randint0(100) + p_ptr->lev) > 50))
                        {
                                /* Remember the Evil-ness */
                                if (m_ptr->ml)
@@ -609,7 +609,7 @@ bool make_attack_normal(int m_idx)
                                case RBM_INSULT:
                                {
                                        syouryaku = -1;
-                                       act = desc_insult[rand_int(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
+                                       act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
                                        sound(SOUND_MOAN);
                                        break;
                                }
@@ -617,7 +617,7 @@ bool make_attack_normal(int m_idx)
                                case RBM_MOAN:
                                {
                                        syouryaku = -1;
-                                       act = desc_moan[rand_int(4)];
+                                       act = desc_moan[randint0(4)];
                                        sound(SOUND_MOAN);
                                        break;
                                }
@@ -628,7 +628,7 @@ bool make_attack_normal(int m_idx)
                                        if (m_ptr->r_idx == MON_JAIAN)
                                        {
 #ifdef JP
-                                               switch(randint(15))
+                                               switch(randint1(15))
                                                {
                                                  case 1:
                                                  case 6:
@@ -701,7 +701,7 @@ bool make_attack_normal(int m_idx)
                                if (do_silly_attack)
                                {
                                        syouryaku = -1;
-                                       act = silly_attacks[rand_int(MAX_SILLY_ATTACK)];
+                                       act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
                                }
 #ifdef JP
                                if(syouryaku==0)
@@ -745,7 +745,7 @@ bool make_attack_normal(int m_idx)
                                case RBE_SUPERHURT:
                                {
                                        int ac = p_ptr->ac+p_ptr->to_a;
-                                       if ((randint(rlev*2+300) > (ac+200)) || one_in_(13)) {
+                                       if ((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) {
                                                int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
 #ifdef JP
                                                msg_print("Ä˺¨¤Î°ì·â¡ª");
@@ -781,7 +781,7 @@ bool make_attack_normal(int m_idx)
                                        /* Take "poison" effect */
                                        if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
                                        {
-                                               if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5))
+                                               if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
                                                {
                                                        obvious = TRUE;
                                                }
@@ -827,7 +827,7 @@ bool make_attack_normal(int m_idx)
                                        for (k = 0; k < 10; k++)
                                        {
                                                /* Pick an item */
-                                               i = rand_int(INVEN_PACK);
+                                               i = randint0(INVEN_PACK);
 
                                                /* Obtain the item */
                                                o_ptr = &inventory[i];
@@ -898,7 +898,7 @@ bool make_attack_normal(int m_idx)
 
                                        /* Saving throw (unless paralyzed) based on dex and level */
                                        if (!p_ptr->paralyzed &&
-                                           (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+                                           (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                                                              p_ptr->lev)))
                                        {
                                                /* Saving throw message */
@@ -910,15 +910,15 @@ bool make_attack_normal(int m_idx)
 
 
                                                /* Occasional blink anyway */
-                                               if (rand_int(3)) blinked = TRUE;
+                                               if (randint0(3)) blinked = TRUE;
                                        }
 
                                        /* Eat gold */
                                        else
                                        {
-                                               gold = (p_ptr->au / 10) + randint(25);
+                                               gold = (p_ptr->au / 10) + randint1(25);
                                                if (gold < 2) gold = 2;
-                                               if (gold > 5000) gold = (p_ptr->au / 20) + randint(3000);
+                                               if (gold > 5000) gold = (p_ptr->au / 20) + randint1(3000);
                                                if (gold > p_ptr->au) gold = p_ptr->au;
                                                p_ptr->au -= gold;
                                                if (gold <= 0)
@@ -979,7 +979,7 @@ bool make_attack_normal(int m_idx)
 
                                        /* Saving throw (unless paralyzed) based on dex and level */
                                        if (!p_ptr->paralyzed &&
-                                           (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+                                           (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                                                              p_ptr->lev)))
                                        {
                                                /* Saving throw message */
@@ -1006,7 +1006,7 @@ bool make_attack_normal(int m_idx)
                                                s16b o_idx;
 
                                                /* Pick an item */
-                                               i = rand_int(INVEN_PACK);
+                                               i = randint0(INVEN_PACK);
 
                                                /* Obtain the item */
                                                o_ptr = &inventory[i];
@@ -1103,7 +1103,7 @@ bool make_attack_normal(int m_idx)
                                        for (k = 0; k < 10; k++)
                                        {
                                                /* Pick an item from the pack */
-                                               i = rand_int(INVEN_PACK);
+                                               i = randint0(INVEN_PACK);
 
                                                /* Get the item */
                                                o_ptr = &inventory[i];
@@ -1157,7 +1157,7 @@ bool make_attack_normal(int m_idx)
                                        if ((o_ptr->xtra4 > 0) && (!artifact_p(o_ptr)))
                                        {
                                                /* Reduce fuel */
-                                               o_ptr->pval -= (250 + randint(250));
+                                               o_ptr->pval -= (250 + randint1(250));
                                                if (o_ptr->pval < 1) o_ptr->pval = 1;
 
                                                /* Notice */
@@ -1281,7 +1281,7 @@ bool make_attack_normal(int m_idx)
                                        /* Increase "blind" */
                                        if (!p_ptr->resist_blind)
                                        {
-                                               if (set_blind(p_ptr->blind + 10 + randint(rlev)))
+                                               if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
                                                {
 #ifdef JP
                                                        if(m_ptr->r_idx == MON_DIO) msg_print("¤É¤¦¤À¥Ã¡ª¤³¤Î·ì¤ÎÌÜÄÙ¤·¤Ï¥Ã¡ª");
@@ -1309,7 +1309,7 @@ bool make_attack_normal(int m_idx)
                                        /* Increase "confused" */
                                        if (!p_ptr->resist_conf)
                                        {
-                                               if (set_confused(p_ptr->confused + 3 + randint(rlev)))
+                                               if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
                                                {
                                                        obvious = TRUE;
                                                }
@@ -1339,7 +1339,7 @@ bool make_attack_normal(int m_idx)
 
                                                obvious = TRUE;
                                        }
-                                       else if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+                                       else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
                                                msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡ª");
@@ -1351,7 +1351,7 @@ bool make_attack_normal(int m_idx)
                                        }
                                        else
                                        {
-                                               if (set_afraid(p_ptr->afraid + 3 + randint(rlev)))
+                                               if (set_afraid(p_ptr->afraid + 3 + randint1(rlev)))
                                                {
                                                        obvious = TRUE;
                                                }
@@ -1381,7 +1381,7 @@ bool make_attack_normal(int m_idx)
 
                                                obvious = TRUE;
                                        }
-                                       else if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+                                       else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
                                                msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -1395,7 +1395,7 @@ bool make_attack_normal(int m_idx)
                                        {
                                                if (!p_ptr->paralyzed)
                                                {
-                                                       if (set_paralyzed(3 + randint(rlev)))
+                                                       if (set_paralyzed(3 + randint1(rlev)))
                                                        {
                                                                obvious = TRUE;
                                                        }
@@ -1537,7 +1537,7 @@ bool make_attack_normal(int m_idx)
                                        if (p_ptr->prace == RACE_ANDROID)
                                        {
                                        }
-                                       else if (p_ptr->hold_life && (rand_int(100) < 95))
+                                       else if (p_ptr->hold_life && (randint0(100) < 95))
                                        {
 #ifdef JP
                                                msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -1586,7 +1586,7 @@ bool make_attack_normal(int m_idx)
                                        if (p_ptr->prace == RACE_ANDROID)
                                        {
                                        }
-                                       else if (p_ptr->hold_life && (rand_int(100) < 90))
+                                       else if (p_ptr->hold_life && (randint0(100) < 90))
                                        {
 #ifdef JP
                                                msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -1635,7 +1635,7 @@ bool make_attack_normal(int m_idx)
                                        if (p_ptr->prace == RACE_ANDROID)
                                        {
                                        }
-                                       else if (p_ptr->hold_life && (rand_int(100) < 75))
+                                       else if (p_ptr->hold_life && (randint0(100) < 75))
                                        {
 #ifdef JP
                                                 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -1684,7 +1684,7 @@ bool make_attack_normal(int m_idx)
                                        if (p_ptr->prace == RACE_ANDROID)
                                        {
                                        }
-                                       else if (p_ptr->hold_life && (rand_int(100) < 50))
+                                       else if (p_ptr->hold_life && (randint0(100) < 50))
                                        {
 #ifdef JP
                                                 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -1730,18 +1730,18 @@ bool make_attack_normal(int m_idx)
                                        /* Take "poison" effect */
                                        if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
                                        {
-                                               if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5))
+                                               if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
                                                {
                                                        obvious = TRUE;
                                                }
                                        }
 
                                        /* Damage CON (10% chance)*/
-                                       if ((randint(100) < 11) && (p_ptr->prace != RACE_ANDROID))
+                                       if ((randint1(100) < 11) && (p_ptr->prace != RACE_ANDROID))
                                        {
                                                /* 1% chance for perm. damage */
                                                bool perm = one_in_(10);
-                                               if (dec_stat(A_CON, randint(10), perm)) obvious = TRUE;
+                                               if (dec_stat(A_CON, randint1(10), perm)) obvious = TRUE;
                                        }
 
                                        break;
@@ -1751,7 +1751,7 @@ bool make_attack_normal(int m_idx)
                                        if (explode) break;
                                        if (!p_ptr->resist_time)
                                        {
-                                               switch (randint(10))
+                                               switch (randint1(10))
                                                {
                                                        case 1: case 2: case 3: case 4: case 5:
                                                        {
@@ -1768,7 +1768,7 @@ bool make_attack_normal(int m_idx)
 
                                                        case 6: case 7: case 8: case 9:
                                                        {
-                                                               int stat = rand_int(6);
+                                                               int stat = randint0(6);
 
                                                                switch (stat)
                                                                {
@@ -1839,7 +1839,7 @@ bool make_attack_normal(int m_idx)
                                        if (p_ptr->prace == RACE_ANDROID)
                                        {
                                        }
-                                       else if (p_ptr->hold_life && (rand_int(100) < 50))
+                                       else if (p_ptr->hold_life && (randint0(100) < 50))
                                        {
 #ifdef JP
 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -1940,7 +1940,7 @@ msg_format("%s
                        if (do_cut && do_stun)
                        {
                                /* Cancel cut */
-                               if (rand_int(100) < 50)
+                               if (randint0(100) < 50)
                                {
                                        do_cut = 0;
                                }
@@ -1964,11 +1964,11 @@ msg_format("%s
                                switch (tmp)
                                {
                                        case 0: k = 0; break;
-                                       case 1: k = randint(5); break;
-                                       case 2: k = randint(5) + 5; break;
-                                       case 3: k = randint(20) + 20; break;
-                                       case 4: k = randint(50) + 50; break;
-                                       case 5: k = randint(100) + 100; break;
+                                       case 1: k = randint1(5); break;
+                                       case 2: k = randint1(5) + 5; break;
+                                       case 3: k = randint1(20) + 20; break;
+                                       case 4: k = randint1(50) + 50; break;
+                                       case 5: k = randint1(100) + 100; break;
                                        case 6: k = 300; break;
                                        default: k = 500; break;
                                }
@@ -1989,11 +1989,11 @@ msg_format("%s
                                switch (tmp)
                                {
                                        case 0: k = 0; break;
-                                       case 1: k = randint(5); break;
-                                       case 2: k = randint(5) + 10; break;
-                                       case 3: k = randint(10) + 20; break;
-                                       case 4: k = randint(15) + 30; break;
-                                       case 5: k = randint(20) + 40; break;
+                                       case 1: k = randint1(5); break;
+                                       case 2: k = randint1(5) + 10; break;
+                                       case 3: k = randint1(10) + 20; break;
+                                       case 4: k = randint1(15) + 30; break;
+                                       case 5: k = randint1(20) + 40; break;
                                        case 6: k = 80; break;
                                        default: k = 150; break;
                                }
index 8ab0d35..9f6ffd8 100644 (file)
@@ -53,8 +53,8 @@ static bool get_enemy_dir(int m_idx, int *mm)
        {
                if (p_ptr->inside_battle)
                {
-                       start = randint(m_max-1)+m_max;
-                       if(rand_int(2)) plus = -1;
+                       start = randint1(m_max-1)+m_max;
+                       if(randint0(2)) plus = -1;
                }
                else start = m_max + 1;
 
@@ -217,7 +217,7 @@ void mon_take_hit_mon(bool is_psy_spear, int m_idx, int dam, bool *fear, cptr no
 
        if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
 
-       if (m_ptr->invulner && rand_int(PENETRATE_INVULNERABILITY))
+       if (m_ptr->invulner && randint0(PENETRATE_INVULNERABILITY))
        {
                if (seen)
                {
@@ -340,7 +340,7 @@ msg_format("%^s
        /* Mega-Hack -- Pain cancels fear */
        if (m_ptr->monfear && (dam > 0))
        {
-               int tmp = randint(dam / 4);
+               int tmp = randint1(dam / 4);
 
                /* Cure a little fear */
                if (tmp < m_ptr->monfear)
@@ -372,14 +372,14 @@ msg_format("%^s
                * Run (sometimes) if at 10% or less of max hit points,
                * or (usually) when hit for half its current hit points
                 */
-               if (((percentage <= 10) && (rand_int(10) < percentage)) ||
-                       ((dam >= m_ptr->hp) && (rand_int(100) < 80)))
+               if (((percentage <= 10) && (randint0(10) < percentage)) ||
+                       ((dam >= m_ptr->hp) && (randint0(100) < 80)))
                {
                        /* Hack -- note fear */
                        (*fear) = TRUE;
 
                        /* XXX XXX XXX Hack -- Add some timed fear */
-                       m_ptr->monfear += (randint(10) +
+                       m_ptr->monfear += (randint1(10) +
                                (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                20 : ((11 - percentage) * 5)));
                }
@@ -1432,7 +1432,7 @@ static int check_hit2(int power, int level, int ac, int stun)
        int i, k;
 
        /* Percentile dice */
-       k = rand_int(100);
+       k = randint0(100);
 
        if (stun && one_in_(2)) return FALSE;
 
@@ -1443,7 +1443,7 @@ static int check_hit2(int power, int level, int ac, int stun)
        i = (power + (level * 3));
 
        /* Power and Level compete against Armor */
-       if ((i > 0) && (randint(i) > ((ac * 3) / 4))) return (TRUE);
+       if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
 
        /* Assume miss */
        return (FALSE);
@@ -1882,7 +1882,7 @@ act = "%s
                        {
                                if (do_silly_attack)
                                {
-                                       act = silly_attacks[rand_int(MAX_SILLY_ATTACK)];
+                                       act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
                                }
                                strfmt(temp, act, t_name);
 #ifdef JP
@@ -1916,7 +1916,7 @@ act = "%s
 
                        case RBE_SUPERHURT:
                                {
-                                       if ((randint(rlev*2+250) > (ac+200)) || one_in_(13)) {
+                                       if ((randint1(rlev*2+250) > (ac+200)) || one_in_(13)) {
                                                int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
                                                damage = MAX(damage, tmp_damage*2);
                                                break;
@@ -2347,17 +2347,17 @@ static void process_monster(int m_idx)
                if (p_ptr->aggravate) tmp /= 2;
                if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
                /* Low-level monsters will find it difficult to locate the player. */
-               if (rand_int(tmp) > (r_ptr->level+20)) aware = FALSE;
+               if (randint0(tmp) > (r_ptr->level+20)) aware = FALSE;
        }
 
        /* Quantum monsters are odd */
        if (r_ptr->flags2 & (RF2_QUANTUM))
        {
                /* Sometimes skip move */
-               if (!rand_int(2)) return;
+               if (!randint0(2)) return;
 
                /* Sometimes die */
-               if (!rand_int((m_idx % 100) + 10) && !(r_ptr->flags1 & RF1_QUESTOR))
+               if (!randint0((m_idx % 100) + 10) && !(r_ptr->flags1 & RF1_QUESTOR))
                {
                        bool sad = FALSE;
 
@@ -2487,7 +2487,7 @@ msg_print("
                u32b notice = 0;
 
                /* Hack -- handle non-aggravation */
-               if (!p_ptr->aggravate) notice = rand_int(1024);
+               if (!p_ptr->aggravate) notice = randint0(1024);
 
                /* Nightmare monsters are more alert */
                if (ironman_nightmare) notice /= 2;
@@ -2570,7 +2570,7 @@ msg_format("%^s
                int d = 1;
 
                /* Make a "saving throw" against stun */
-               if (rand_int(10000) <= r_ptr->level * r_ptr->level)
+               if (randint0(10000) <= r_ptr->level * r_ptr->level)
                {
                        /* Recover fully */
                        d = m_ptr->stunned;
@@ -2618,7 +2618,7 @@ msg_format("%^s
        if (m_ptr->confused)
        {
                /* Amount of "boldness" */
-               int d = randint(r_ptr->level / 20 + 1);
+               int d = randint1(r_ptr->level / 20 + 1);
 
                /* Still confused */
                if (m_ptr->confused > d)
@@ -2768,7 +2768,7 @@ msg_format("%^s
        if (m_ptr->monfear)
        {
                /* Amount of "boldness" */
-               int d = randint(r_ptr->level / 20 + 1);
+               int d = randint1(r_ptr->level / 20 + 1);
 
                /* Still afraid */
                if (m_ptr->monfear > d)
@@ -2828,7 +2828,7 @@ msg_format("%^s
                }
 
                /* Hack -- multiply slower in crowded areas */
-               if ((k < 4) && (!k || !rand_int(k * MON_MULT_ADJ)))
+               if ((k < 4) && (!k || !randint0(k * MON_MULT_ADJ)))
                {
                        /* Try to multiply */
                        if (multiply_monster(m_idx, FALSE, is_friendly(m_ptr), is_pet(m_ptr)))
@@ -2952,7 +2952,7 @@ msg_format("%^s%s", m_name, monmessage);
        /* 75% random movement */
        else if ((r_ptr->flags1 & RF1_RAND_50) &&
                                (r_ptr->flags1 & RF1_RAND_25) &&
-                (rand_int(100) < 75))
+                (randint0(100) < 75))
        {
                /* Memorize flags */
                if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50);
@@ -2964,7 +2964,7 @@ msg_format("%^s%s", m_name, monmessage);
 
        /* 50% random movement */
        else if ((r_ptr->flags1 & RF1_RAND_50) &&
-                               (rand_int(100) < 50))
+                               (randint0(100) < 50))
        {
                /* Memorize flags */
                if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50);
@@ -2975,7 +2975,7 @@ msg_format("%^s%s", m_name, monmessage);
 
        /* 25% random movement */
        else if ((r_ptr->flags1 & RF1_RAND_25) &&
-                               (rand_int(100) < 25))
+                               (randint0(100) < 25))
        {
                /* Memorize flags */
                if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_25;
@@ -3079,7 +3079,7 @@ msg_format("%^s%s", m_name, monmessage);
                d = mm[i];
 
                /* Hack -- allow "randomized" motion */
-               if (d == 5) d = ddd[rand_int(8)];
+               if (d == 5) d = ddd[randint0(8)];
 
                /* Get the destination */
                ny = oy + ddy[d];
@@ -3166,7 +3166,7 @@ msg_print("
                        c_ptr->info &= ~(CAVE_MARK);
 
                        /* Notice */
-                       c_ptr->feat = floor_type[rand_int(100)];
+                       c_ptr->feat = floor_type[randint0(100)];
                        c_ptr->info &= ~(CAVE_MASK);
                        c_ptr->info |= CAVE_FLOOR;
 
@@ -3211,7 +3211,7 @@ msg_print("
                                        k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
 
                                        /* Try to unlock it XXX XXX XXX */
-                                       if (rand_int(m_ptr->hp / 10) > k)
+                                       if (randint0(m_ptr->hp / 10) > k)
                                        {
                                                /* Unlock the door */
                                                cave_set_feat(ny, nx, FEAT_DOOR_HEAD + 0x00);
@@ -3232,7 +3232,7 @@ msg_print("
                                k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
 
                                /* Attempt to Bash XXX XXX XXX */
-                               if (rand_int(m_ptr->hp / 10) > k)
+                               if (randint0(m_ptr->hp / 10) > k)
                                {
                                        /* Message */
 #ifdef JP
@@ -3258,7 +3258,7 @@ msg_print("
                        if (did_open_door || did_bash_door)
                        {
                                /* Break down the door */
-                               if (did_bash_door && (rand_int(100) < 50))
+                               if (did_bash_door && (randint0(100) < 50))
                                {
                                        cave_set_feat(ny, nx, FEAT_BROKEN);
                                }
@@ -3282,7 +3282,7 @@ msg_print("
                        do_move = FALSE;
 
                        /* Break the ward */
-                       if (!is_pet(m_ptr) && (randint(BREAK_GLYPH) < r_ptr->level))
+                       if (!is_pet(m_ptr) && (randint1(BREAK_GLYPH) < r_ptr->level))
                        {
                                /* Describe observable breakage */
                                if (c_ptr->info & CAVE_MARK)
@@ -3299,7 +3299,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Break the rune */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
 
@@ -3320,7 +3320,7 @@ msg_print("
                        if (!is_pet(m_ptr))
                        {
                                /* Break the ward */
-                               if (randint(BREAK_MINOR_GLYPH) > r_ptr->level)
+                               if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
                                {
                                        /* Describe observable breakage */
                                        if (c_ptr->info & CAVE_MARK)
@@ -3347,7 +3347,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Break the rune */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
                                note_spot(ny, nx);
@@ -3970,7 +3970,7 @@ void process_monsters(void)
                e = extract_energy[speed];
 
                /* Give this monster some energy */
-               if(rand_int(60) < e)
+               if(randint0(60) < e)
                m_ptr->energy += gain_energy();
 
 
index 097898e..a4b5298 100644 (file)
@@ -885,7 +885,7 @@ if (!b) msg_print("
                /* Mindblast */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               if (randint(100) < plev * 2)
+               if (randint1(100) < plev * 2)
                        fire_beam(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
                else
                        fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
@@ -946,7 +946,7 @@ msg_print("
                        project(0, 2 + plev / 10, py, px,
                        (plev * 3), GF_PSI, PROJECT_KILL, -1);
                else
-                       (void)mindblast_monsters(randint(plev * ((plev - 5) / 10 + 1)));
+                       (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1)));
                break;
        case 9:
                /* Adrenaline */
@@ -962,7 +962,7 @@ msg_print("
                        hp_player(plev);
                }
 
-               b = 10 + randint((plev * 3) / 2);
+               b = 10 + randint1((plev * 3) / 2);
                set_hero(b, FALSE);
                /* Haste */
                (void)set_fast(b, FALSE);
@@ -982,13 +982,13 @@ msg_print("
 
                /* This is always a radius-0 ball now */
                if (fire_ball(GF_PSI_DRAIN, dir, b, 0))
-                       p_ptr->energy -= randint(150);
+                       p_ptr->energy -= randint1(150);
                break;
        case 12:
                /* psycho-spear */
                if (!get_aim_dir(&dir)) return FALSE;
 
-               fire_beam(GF_PSY_SPEAR, dir, randint(plev*3)+plev*3);
+               fire_beam(GF_PSY_SPEAR, dir, randint1(plev*3)+plev*3);
                break;
        case 13:
        {
@@ -1059,7 +1059,7 @@ static bool cast_force_spell(int spell)
                (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
                break;
        case 2:
-               set_tim_ffall(randint(30) + 30 + boost / 5, FALSE);
+               set_tim_ffall(randint1(30) + 30 + boost / 5, FALSE);
                break;
        case 3:
                project_length = plev / 8 + 3;
@@ -1068,7 +1068,7 @@ static bool cast_force_spell(int spell)
                fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
                break;
        case 4:
-               set_resist_magic(randint(20) + 20 + boost / 5, FALSE);
+               set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
                break;
        case 5:
 #ifdef JP
@@ -1077,7 +1077,7 @@ static bool cast_force_spell(int spell)
                msg_print("You improved the Force.");
 #endif
                p_ptr->magic_num1[0] += (70 + plev);
-               if (randint(p_ptr->magic_num1[0]) > (plev * 4 + 120))
+               if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
                {
 #ifdef JP
                        msg_print("µ¤¤¬Ë½Áö¤·¤¿¡ª");
@@ -1094,7 +1094,7 @@ static bool cast_force_spell(int spell)
                else return TRUE;
                break;
        case 6:
-               set_tim_sh_touki(randint(plev / 2) + 15 + boost / 7, FALSE);
+               set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
                break;
        case 7:
        {
@@ -1117,7 +1117,7 @@ static bool cast_force_spell(int spell)
 
                        monster_desc(m_name, m_ptr, 0);
 
-                       if (randint(r_info[m_ptr->r_idx].level * 3 / 2) > rand_int(dam / 2) + dam/2)
+                       if (randint1(r_info[m_ptr->r_idx].level * 3 / 2) > randint0(dam / 2) + dam/2)
                        {
 #ifdef JP
                                msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
@@ -1239,7 +1239,7 @@ msg_print("
                fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
                break;
        case 13:
-               set_lightspeed(randint(16) + 16 + boost / 20, FALSE);
+               set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
                break;
        default:
 #ifdef JP
@@ -1329,7 +1329,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* robe of dust */
        case 6:
-         set_dustrobe(20+randint(20),FALSE);
+         set_dustrobe(20+randint1(20),FALSE);
          break;
        /* banishing mirror */
        case 7:
@@ -1363,7 +1363,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* shield of water */
        case 12:
-         tmp = 20+randint(20);
+         tmp = 20+randint1(20);
          set_shield(tmp, FALSE);
          if( plev > 31 )set_tim_reflect(tmp, FALSE);
          if( plev > 39 )set_resist_magic(tmp,FALSE);
@@ -1371,7 +1371,7 @@ msg_format("There are too many mirrors to control!");
        /* super ray */
        case 13:
          if (!get_aim_dir(&dir)) return FALSE;
-         fire_beam(GF_SUPER_RAY,dir, 150+randint(2*plev));
+         fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
          break;
        /* illusion light */
        case 14:
@@ -1409,7 +1409,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* multi-shadow */
        case 18:
-         set_multishadow(6+randint(6),FALSE);
+         set_multishadow(6+randint1(6),FALSE);
          break;
        /* binding field */
        case 19:
@@ -1421,7 +1421,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* mirror of Ruffnor */
        case 20:
-         (void)set_invuln(randint(4)+4,FALSE);
+         (void)set_invuln(randint1(4)+4,FALSE);
          break;
        default:
 #ifdef JP
@@ -1536,7 +1536,7 @@ static bool cast_berserk_spell(int spell)
                break;
        }
        case 3:
-               earthquake(py, px, 8+rand_int(5));
+               earthquake(py, px, 8+randint0(5));
                break;
        case 4:
        {
@@ -1641,7 +1641,7 @@ static bool cast_ninja_spell(int spell)
                if (cave[y][x].m_idx)
                {
                        py_attack(y, x, 0);
-                       if (rand_int(p_ptr->skill_dis) < 7)
+                       if (randint0(p_ptr->skill_dis) < 7)
 #ifdef JP
 msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
 #else
@@ -1676,7 +1676,7 @@ msg_print("
                return ident_spell(FALSE);
                break;
        case 8:
-               set_tim_ffall(randint(20) + 20, FALSE);
+               set_tim_ffall(randint1(20) + 20, FALSE);
                break;
        case 9:
                fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
@@ -1805,7 +1805,7 @@ msg_print("
                explosive_rune();
                break;
        case 16:
-               (void)set_kabenuke(randint(plev/2) + plev/2, FALSE);
+               (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
                set_oppose_acid(plev, FALSE);
                break;
        case 17:
@@ -1838,7 +1838,7 @@ msg_print("
                break;
        }
        case 19:
-               set_multishadow(6+randint(6), FALSE);
+               set_multishadow(6+randint1(6), FALSE);
                break;
        default:
 #ifdef JP
@@ -2003,7 +2003,7 @@ if (!get_check("
        if (chance > 95) chance = 95;
 
        /* Failed spell */
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 #ifdef JP
@@ -2026,10 +2026,10 @@ msg_format("%s
                                p_ptr->magic_num1[0] = 0;
                        }
 
-                       if (randint(100) < (chance / 2))
+                       if (randint1(100) < (chance / 2))
                        {
                                /* Backfire */
-                         b = randint(100);
+                         b = randint1(100);
 
                          if( use_mind == MIND_MINDCRAFTER ){
                                if (b < 5)
@@ -2050,7 +2050,7 @@ msg_print("
                                        msg_print("Weird visions seem to dance before your eyes...");
 #endif
 
-                                       set_image(p_ptr->image + 5 + randint(10));
+                                       set_image(p_ptr->image + 5 + randint1(10));
                                }
                                else if (b < 45)
                                {
@@ -2060,11 +2060,11 @@ msg_print("
                                        msg_print("Your brain is addled!");
 #endif
 
-                                       set_confused(p_ptr->confused + randint(8));
+                                       set_confused(p_ptr->confused + randint1(8));
                                }
                                else if (b < 90)
                                {
-                                       set_stun(p_ptr->stun + randint(8));
+                                       set_stun(p_ptr->stun + randint1(8));
                                }
                                else
                                {
@@ -2103,7 +2103,7 @@ msg_print("
                                        msg_print("Your brain is addled!");
 #endif
 
-                                       set_image(p_ptr->image + 5 + randint(10));
+                                       set_image(p_ptr->image + 5 + randint1(10));
                                }
                                else
                                {
@@ -2216,12 +2216,12 @@ msg_format("%s
 
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                /* Damage WIS (possibly permanently) */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                {
-                       bool perm = (rand_int(100) < 25);
+                       bool perm = (randint0(100) < 25);
 
                        /* Message */
 #ifdef JP
@@ -2232,7 +2232,7 @@ msg_print("
 
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_WIS, 15 + randint(10), perm);
+                       (void)dec_stat(A_WIS, 15 + randint1(10), perm);
                }
        }
 
index b5ae2ce..90297f7 100644 (file)
@@ -3710,34 +3710,34 @@ void create_name(int type, char *name)
        {
                /* Create the monster name */
                case NAME_DWARF:
-                       strcpy(name, dwarf_syllable1[rand_int(sizeof(dwarf_syllable1) / sizeof(char*))]);
-                       strcat(name, dwarf_syllable2[rand_int(sizeof(dwarf_syllable2) / sizeof(char*))]);
-                       strcat(name, dwarf_syllable3[rand_int(sizeof(dwarf_syllable3) / sizeof(char*))]);
+                       strcpy(name, dwarf_syllable1[randint0(sizeof(dwarf_syllable1) / sizeof(char*))]);
+                       strcat(name, dwarf_syllable2[randint0(sizeof(dwarf_syllable2) / sizeof(char*))]);
+                       strcat(name, dwarf_syllable3[randint0(sizeof(dwarf_syllable3) / sizeof(char*))]);
                        break;
                case NAME_ELF:
-                       strcpy(name, elf_syllable1[rand_int(sizeof(elf_syllable1) / sizeof(char*))]);
-                       strcat(name, elf_syllable2[rand_int(sizeof(elf_syllable2) / sizeof(char*))]);
-                       strcat(name, elf_syllable3[rand_int(sizeof(elf_syllable3) / sizeof(char*))]);
+                       strcpy(name, elf_syllable1[randint0(sizeof(elf_syllable1) / sizeof(char*))]);
+                       strcat(name, elf_syllable2[randint0(sizeof(elf_syllable2) / sizeof(char*))]);
+                       strcat(name, elf_syllable3[randint0(sizeof(elf_syllable3) / sizeof(char*))]);
                        break;
                case NAME_GNOME:
-                       strcpy(name, gnome_syllable1[rand_int(sizeof(gnome_syllable1) / sizeof(char*))]);
-                       strcat(name, gnome_syllable2[rand_int(sizeof(gnome_syllable2) / sizeof(char*))]);
-                       strcat(name, gnome_syllable3[rand_int(sizeof(gnome_syllable3) / sizeof(char*))]);
+                       strcpy(name, gnome_syllable1[randint0(sizeof(gnome_syllable1) / sizeof(char*))]);
+                       strcat(name, gnome_syllable2[randint0(sizeof(gnome_syllable2) / sizeof(char*))]);
+                       strcat(name, gnome_syllable3[randint0(sizeof(gnome_syllable3) / sizeof(char*))]);
                        break;
                case NAME_HOBBIT:
-                       strcpy(name, hobbit_syllable1[rand_int(sizeof(hobbit_syllable1) / sizeof(char*))]);
-                       strcat(name, hobbit_syllable2[rand_int(sizeof(hobbit_syllable2) / sizeof(char*))]);
-                       strcat(name, hobbit_syllable3[rand_int(sizeof(hobbit_syllable3) / sizeof(char*))]);
+                       strcpy(name, hobbit_syllable1[randint0(sizeof(hobbit_syllable1) / sizeof(char*))]);
+                       strcat(name, hobbit_syllable2[randint0(sizeof(hobbit_syllable2) / sizeof(char*))]);
+                       strcat(name, hobbit_syllable3[randint0(sizeof(hobbit_syllable3) / sizeof(char*))]);
                        break;
                case NAME_HUMAN:
-                       strcpy(name, human_syllable1[rand_int(sizeof(human_syllable1) / sizeof(char*))]);
-                       strcat(name, human_syllable2[rand_int(sizeof(human_syllable2) / sizeof(char*))]);
-                       strcat(name, human_syllable3[rand_int(sizeof(human_syllable3) / sizeof(char*))]);
+                       strcpy(name, human_syllable1[randint0(sizeof(human_syllable1) / sizeof(char*))]);
+                       strcat(name, human_syllable2[randint0(sizeof(human_syllable2) / sizeof(char*))]);
+                       strcat(name, human_syllable3[randint0(sizeof(human_syllable3) / sizeof(char*))]);
                        break;
                case NAME_ORC:
-                       strcpy(name, orc_syllable1[rand_int(sizeof(orc_syllable1) / sizeof(char*))]);
-                       strcat(name, orc_syllable2[rand_int(sizeof(orc_syllable2) / sizeof(char*))]);
-                       strcat(name, orc_syllable3[rand_int(sizeof(orc_syllable3) / sizeof(char*))]);
+                       strcpy(name, orc_syllable1[randint0(sizeof(orc_syllable1) / sizeof(char*))]);
+                       strcat(name, orc_syllable2[randint0(sizeof(orc_syllable2) / sizeof(char*))]);
+                       strcat(name, orc_syllable3[randint0(sizeof(orc_syllable3) / sizeof(char*))]);
                        break;
                /* Create an empty name */
                default:
index b719258..0022932 100644 (file)
@@ -399,7 +399,7 @@ void compact_monsters(int size)
                        if (r_ptr->flags1 & (RF1_UNIQUE)) chance = 100;
 
                        /* All monsters get a saving throw */
-                       if (rand_int(100) < chance) continue;
+                       if (randint0(100) < chance) continue;
 
                        /* Delete the monster */
                        delete_monster_idx(i);
@@ -1151,7 +1151,7 @@ errr get_mon_num_prep(monster_hook_type monster_hook,
                {
                        int hoge = entry->prob2 * d_info[dungeon_type].special_div;
                        entry->prob2 = hoge / 64;
-                       if (rand_int(64) < (hoge & 0x3f)) entry->prob2++;
+                       if (randint0(64) < (hoge & 0x3f)) entry->prob2++;
                }
        }
 
@@ -1259,15 +1259,15 @@ s16b get_mon_num(int level)
        if ((level > 0) && !p_ptr->inside_battle && !(d_info[dungeon_type].flags1 & DF1_BEGINNER))
        {
                /* Nightmare mode allows more out-of depth monsters */
-               if (ironman_nightmare && !rand_int(pls_kakuritu))
+               if (ironman_nightmare && !randint0(pls_kakuritu))
                {
                        /* What a bizarre calculation */
-                       level = 1 + (level * MAX_DEPTH / randint(MAX_DEPTH));
+                       level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
                }
                else
                {
                        /* Occasional "nasty" monster */
-                       if (!rand_int(pls_kakuritu))
+                       if (!randint0(pls_kakuritu))
                        {
                                /* Pick a level bonus */
                                int d = MIN(5, level/10) + pls_level;
@@ -1277,7 +1277,7 @@ s16b get_mon_num(int level)
                        }
 
                        /* Occasional "nasty" monster */
-                       if (!rand_int(pls_kakuritu))
+                       if (!randint0(pls_kakuritu))
                        {
                                /* Pick a level bonus */
                                int d = MIN(5, level/10) + pls_level;
@@ -1349,7 +1349,7 @@ s16b get_mon_num(int level)
 
 
        /* Pick a monster */
-       value = rand_int(total);
+       value = randint0(total);
 
        /* Find the monster */
        for (i = 0; i < alloc_race_size; i++)
@@ -1363,7 +1363,7 @@ s16b get_mon_num(int level)
 
 
        /* Power boost */
-       p = rand_int(100);
+       p = randint0(100);
 
        /* Try for a "harder" monster once (50%) or twice (10%) */
        if (p < 60)
@@ -1372,7 +1372,7 @@ s16b get_mon_num(int level)
                j = i;
 
                /* Pick a monster */
-               value = rand_int(total);
+               value = randint0(total);
 
                /* Find the monster */
                for (i = 0; i < alloc_race_size; i++)
@@ -1395,7 +1395,7 @@ s16b get_mon_num(int level)
                j = i;
 
                /* Pick a monster */
-               value = rand_int(total);
+               value = randint0(total);
 
                /* Find the monster */
                for (i = 0; i < alloc_race_size; i++)
@@ -1505,7 +1505,7 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name))
 
                        do
                        {
-                               hallu_race = &r_info[randint(max_r_idx - 1)];
+                               hallu_race = &r_info[randint1(max_r_idx - 1)];
                        }
                        while (hallu_race->flags1 & RF1_UNIQUE);
 
@@ -1866,7 +1866,7 @@ void sanity_blast(monster_type *m_ptr, bool necro)
                if (is_pet(m_ptr))
                        return; /* Pet eldritch horrors are safe most of the time */
 
-               if (randint(100) > power) return;
+               if (randint1(100) > power) return;
 
                if (saving_throw(p_ptr->skill_sav - power))
                {
@@ -1882,12 +1882,12 @@ msg_format("%s%s
                        msg_format("You behold the %s visage of %s!",
 #endif
 
-                               funny_desc[rand_int(MAX_SAN_FUNNY)], m_name);
+                               funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
 
                        if (one_in_(3))
                        {
-                               msg_print(funny_comments[rand_int(MAX_SAN_COMMENT)]);
-                               p_ptr->image = p_ptr->image + randint(r_ptr->level);
+                               msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
+                               p_ptr->image = p_ptr->image + randint1(r_ptr->level);
                        }
 
                        return; /* Never mind; we can't see it clearly enough */
@@ -1900,7 +1900,7 @@ msg_format("%s%s
                msg_format("You behold the %s visage of %s!",
 #endif
 
-                       horror_desc[rand_int(MAX_SAN_HORROR)], m_name);
+                       horror_desc[randint0(MAX_SAN_HORROR)], m_name);
 
                r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
 
@@ -1930,11 +1930,11 @@ msg_print("
        {
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->resist_chaos && one_in_(3))
                {
-                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                       (void)set_image(p_ptr->image + randint0(250) + 150);
                }
                return;
        }
@@ -1950,19 +1950,19 @@ msg_print("
        {
                if (!p_ptr->resist_conf)
                {
-                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                }
                if (!p_ptr->free_act)
                {
-                       (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
                }
-               while (rand_int(100) > p_ptr->skill_sav)
+               while (randint0(100) > p_ptr->skill_sav)
                        (void)do_dec_stat(A_INT);
-               while (rand_int(100) > p_ptr->skill_sav)
+               while (randint0(100) > p_ptr->skill_sav)
                        (void)do_dec_stat(A_WIS);
                if (!p_ptr->resist_chaos)
                {
-                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                       (void)set_image(p_ptr->image + randint0(250) + 150);
                }
                return;
        }
@@ -1996,7 +1996,7 @@ msg_print("
 
        while (!happened)
        {
-               switch (randint(21))
+               switch (randint1(21))
                {
                        case 1:
                                if (!(p_ptr->muta3 & MUT3_MORONIC) && one_in_(5))
@@ -2521,7 +2521,7 @@ void choose_new_monster(int m_idx, bool born, int r_idx)
                        else
                                level = dun_level;
 
-                       if (d_info[dungeon_type].flags1 & DF1_CHAMELEON) level+= 2+randint(3);
+                       if (d_info[dungeon_type].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
                        r_idx = get_mon_num(level);
                        r_ptr = &r_info[r_idx];
 
@@ -2715,7 +2715,7 @@ bool place_monster_one(int y, int x, int r_idx, bool slp, bool friendly, bool pe
 
        if (c_ptr->feat == FEAT_GLYPH)
        {
-               if (randint(BREAK_GLYPH) < (r_ptr->level+20))
+               if (randint1(BREAK_GLYPH) < (r_ptr->level+20))
                {
                        /* Describe observable breakage */
                        if (c_ptr->info & CAVE_MARK)
@@ -2732,7 +2732,7 @@ msg_print("
                        c_ptr->info &= ~(CAVE_MARK);
 
                        /* Break the rune */
-                       c_ptr->feat = floor_type[rand_int(100)];
+                       c_ptr->feat = floor_type[randint0(100)];
                        c_ptr->info &= ~(CAVE_MASK);
                        c_ptr->info |= CAVE_FLOOR;
 
@@ -2861,7 +2861,7 @@ msg_print("
        if (slp && r_ptr->sleep && !ironman_nightmare)
        {
                int val = r_ptr->sleep;
-               m_ptr->csleep = ((val * 2) + randint(val * 10));
+               m_ptr->csleep = ((val * 2) + randint1(val * 10));
        }
 
        /* Assign maximal hitpoints */
@@ -2910,7 +2910,7 @@ msg_print("
        if (m_ptr->mspeed > 199) m_ptr->mspeed = 199;
 
        /* Give a random starting energy */
-       m_ptr->energy = (byte)rand_int(100);
+       m_ptr->energy = (byte)randint0(100);
 
        /* Nightmare monsters are more prepared */
        if (ironman_nightmare)
@@ -3012,7 +3012,7 @@ msg_print("
        if (c_ptr->feat == FEAT_MINOR_GLYPH)
        {
                /* Break the ward */
-               if (randint(BREAK_MINOR_GLYPH) > r_ptr->level)
+               if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
                {
                        /* Describe observable breakage */
                        if (c_ptr->info & CAVE_MARK)
@@ -3039,7 +3039,7 @@ msg_print("
                c_ptr->info &= ~(CAVE_MARK);
 
                /* Break the rune */
-               c_ptr->feat = floor_type[rand_int(100)];
+               c_ptr->feat = floor_type[randint0(100)];
                c_ptr->info &= ~(CAVE_MASK);
                c_ptr->info |= CAVE_FLOOR;
                note_spot(y, x);
@@ -3148,20 +3148,20 @@ static bool place_monster_group(int y, int x, int r_idx, bool slp, bool friendly
 
 
        /* Pick a group size */
-       total = randint(10);
+       total = randint1(10);
 
        /* Hard monsters, small groups */
        if (r_ptr->level > dun_level)
        {
                extra = r_ptr->level - dun_level;
-               extra = 0 - randint(extra);
+               extra = 0 - randint1(extra);
        }
 
        /* Easy monsters, large groups */
        else if (r_ptr->level < dun_level)
        {
                extra = dun_level - r_ptr->level;
-               extra = randint(extra);
+               extra = randint1(extra);
        }
 
        /* Hack -- limit group reduction */
@@ -3429,7 +3429,7 @@ bool alloc_horde(int y, int x)
        if (m_list[m_idx].mflag2 & MFLAG_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx];
        summon_kin_type = r_ptr->d_char;
 
-       for (attempts = randint(10) + 5; attempts; attempts--)
+       for (attempts = randint1(10) + 5; attempts; attempts--)
        {
                scatter(&cy, &cx, y, x, 5, 0);
 
@@ -3473,8 +3473,8 @@ bool alloc_monster(int dis, bool slp)
                 while(try)
                 {
                         /* Get a random spot */
-                        oy = randint(cur_hgt - 4) + 2;
-                        ox = randint(cur_wid - 4) + 2;
+                        oy = randint1(cur_hgt - 4) + 2;
+                        ox = randint1(cur_wid - 4) + 2;
 
                         /* Is it a good spot ? */
                         if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian]))
@@ -3492,8 +3492,8 @@ bool alloc_monster(int dis, bool slp)
        while (attempts_left--)
        {
                /* Pick a location */
-               y = rand_int(cur_hgt);
-               x = rand_int(cur_wid);
+               y = randint0(cur_hgt);
+               x = randint0(cur_wid);
 
                /* Require empty floor grid (was "naked") */
                if (dun_level || (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain != TERRAIN_MOUNTAIN))
@@ -3526,7 +3526,7 @@ msg_print("
 
 
 #ifdef MONSTER_HORDES
-       if (randint(5000) <= dun_level)
+       if (randint1(5000) <= dun_level)
        {
                if (alloc_horde(y, x))
                {
@@ -4477,7 +4477,7 @@ void update_smart_learn(int m_idx, int what)
        if (r_ptr->flags2 & (RF2_STUPID)) return;
 
        /* Not intelligent, only learn sometimes */
-       if (!(r_ptr->flags2 & (RF2_SMART)) && (rand_int(100) < 50)) return;
+       if (!(r_ptr->flags2 & (RF2_SMART)) && (randint0(100) < 50)) return;
 
 
        /* XXX XXX XXX */
index da1f3e4..09d1de0 100644 (file)
@@ -56,7 +56,7 @@ static bool int_outof(monster_race *r_ptr, int prob)
        if (!(r_ptr->flags2 & RF2_SMART)) prob = prob / 2;
 
        /* Roll the dice */
-       return (rand_int(100) < prob);
+       return (randint0(100) < prob);
 }
 
 
@@ -88,7 +88,7 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
        if (smart_learn)
        {
                /* Hack -- Occasionally forget player status */
-               if (m_ptr->smart && (rand_int(100) < 1)) m_ptr->smart = 0L;
+               if (m_ptr->smart && (randint0(100) < 1)) m_ptr->smart = 0L;
 
                /* Use the memorized flags */
                smart = m_ptr->smart;
@@ -519,9 +519,9 @@ void curse_equipment(int chance, int heavy_chance)
 {
        bool        changed = FALSE;
        u32b        o1, o2, o3;
-       object_type *o_ptr = &inventory[INVEN_RARM + rand_int(12)];
+       object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)];
 
-       if (randint(100) > chance) return;
+       if (randint1(100) > chance) return;
 
        if (!o_ptr->k_idx) return;
 
@@ -529,7 +529,7 @@ void curse_equipment(int chance, int heavy_chance)
 
 
        /* Extra, biased saving throw for blessed items */
-       if ((o3 & TR3_BLESSED) && (randint(888) > chance))
+       if ((o3 & TR3_BLESSED) && (randint1(888) > chance))
        {
                char o_name[MAX_NLEN];
                object_desc(o_name, o_ptr, FALSE, 0);
@@ -544,7 +544,7 @@ msg_format("%s
                return;
        }
 
-       if ((randint(100) <= heavy_chance) &&
+       if ((randint1(100) <= heavy_chance) &&
                (o_ptr->name1 || o_ptr->name2 || o_ptr->art_name))
        {
                if (!(o3 & TR3_HEAVY_CURSE))
@@ -929,7 +929,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
        if (r_ptr->flags2 & (RF2_STUPID))
        {
                /* Pick at random */
-               return (spells[rand_int(num)]);
+               return (spells[randint0(num)]);
        }
 
        /* Categorize spells */
@@ -978,10 +978,10 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
        /*** Try to pick an appropriate spell type ***/
 
        /* world */
-       if (world_num && (rand_int(100) < 15) && !world_monster)
+       if (world_num && (randint0(100) < 15) && !world_monster)
        {
                /* Choose haste spell */
-               return (world[rand_int(world_num)]);
+               return (world[randint0(world_num)]);
        }
 
        /* special */
@@ -996,21 +996,21 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
                                break;
                        default: break;
                }
-               if (success) return (special[rand_int(special_num)]);
+               if (success) return (special[randint0(special_num)]);
        }
 
        /* Still hurt badly, couldn't flee, attempt to heal */
        if (m_ptr->hp < m_ptr->maxhp / 3 && one_in_(2))
        {
                /* Choose heal spell if possible */
-               if (heal_num) return (heal[rand_int(heal_num)]);
+               if (heal_num) return (heal[randint0(heal_num)]);
        }
 
        /* Hurt badly or afraid, attempt to flee */
        if (((m_ptr->hp < m_ptr->maxhp / 3) || m_ptr->monfear) && one_in_(2))
        {
                /* Choose escape spell if possible */
-               if (escape_num) return (escape[rand_int(escape_num)]);
+               if (escape_num) return (escape[randint0(escape_num)]);
        }
 
        /* special */
@@ -1020,28 +1020,28 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
                switch(m_ptr->r_idx)
                {
                        case MON_OHMU:
-                               if (rand_int(100) < 50) success = TRUE;
+                               if (randint0(100) < 50) success = TRUE;
                                break;
                        case MON_BANORLUPART:
-                               if (rand_int(100) < 70) success = TRUE;
+                               if (randint0(100) < 70) success = TRUE;
                                break;
                        default: break;
                }
-               if (success) return (special[rand_int(special_num)]);
+               if (success) return (special[randint0(special_num)]);
        }
 
        /* Player is close and we have attack spells, blink away */
-       if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (rand_int(100) < 75) && !world_monster)
+       if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster)
        {
                /* Choose tactical spell */
-               if (tactic_num) return (tactic[rand_int(tactic_num)]);
+               if (tactic_num) return (tactic[randint0(tactic_num)]);
        }
 
        /* Summon if possible (sometimes) */
-       if (summon_num && (rand_int(100) < 40))
+       if (summon_num && (randint0(100) < 40))
        {
                /* Choose summon spell */
-               return (summon[rand_int(summon_num)]);
+               return (summon[randint0(summon_num)]);
        }
 
        /* dispel */
@@ -1050,70 +1050,70 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
                /* Choose dispel spell if possible */
                if (dispel_check(m_idx))
                {
-                       return (dispel[rand_int(dispel_num)]);
+                       return (dispel[randint0(dispel_num)]);
                }
        }
 
        /* Raise-dead if possible (sometimes) */
-       if (raise_num && (rand_int(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
+       if (raise_num && (randint0(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
        {
                /* Choose raise-dead spell */
-               return (raise[rand_int(raise_num)]);
+               return (raise[randint0(raise_num)]);
        }
 
        /* Attack spell (most of the time) */
        if (p_ptr->invuln)
        {
-               if (psy_spe_num && (rand_int(100) < 50))
+               if (psy_spe_num && (randint0(100) < 50))
                {
                        /* Choose attack spell */
-                       return (psy_spe[rand_int(psy_spe_num)]);
+                       return (psy_spe[randint0(psy_spe_num)]);
                }
-               else if (attack_num && (rand_int(100) < 40))
+               else if (attack_num && (randint0(100) < 40))
                {
                        /* Choose attack spell */
-                       return (attack[rand_int(attack_num)]);
+                       return (attack[randint0(attack_num)]);
                }
        }
-       else if (attack_num && (rand_int(100) < 85))
+       else if (attack_num && (randint0(100) < 85))
        {
                /* Choose attack spell */
-               return (attack[rand_int(attack_num)]);
+               return (attack[randint0(attack_num)]);
        }
 
        /* Try another tactical spell (sometimes) */
-       if (tactic_num && (rand_int(100) < 50) && !world_monster)
+       if (tactic_num && (randint0(100) < 50) && !world_monster)
        {
                /* Choose tactic spell */
-               return (tactic[rand_int(tactic_num)]);
+               return (tactic[randint0(tactic_num)]);
        }
 
        /* Cast globe of invulnerability if not already in effect */
-       if (invul_num && !(m_ptr->invulner) && (rand_int(100) < 50))
+       if (invul_num && !(m_ptr->invulner) && (randint0(100) < 50))
        {
                /* Choose Globe of Invulnerability */
-               return (invul[rand_int(invul_num)]);
+               return (invul[randint0(invul_num)]);
        }
 
        /* We're hurt (not badly), try to heal */
-       if ((m_ptr->hp < m_ptr->maxhp * 3 / 4) && (rand_int(100) < 25))
+       if ((m_ptr->hp < m_ptr->maxhp * 3 / 4) && (randint0(100) < 25))
        {
                /* Choose heal spell if possible */
-               if (heal_num) return (heal[rand_int(heal_num)]);
+               if (heal_num) return (heal[randint0(heal_num)]);
        }
 
        /* Haste self if we aren't already somewhat hasted (rarely) */
-       if (haste_num && (rand_int(100) < 20) && !(m_ptr->fast))
+       if (haste_num && (randint0(100) < 20) && !(m_ptr->fast))
        {
                /* Choose haste spell */
-               return (haste[rand_int(haste_num)]);
+               return (haste[randint0(haste_num)]);
        }
 
        /* Annoy player (most of the time) */
-       if (annoy_num && (rand_int(100) < 80))
+       if (annoy_num && (randint0(100) < 80))
        {
                /* Choose annoyance spell */
-               return (annoy[rand_int(annoy_num)]);
+               return (annoy[randint0(annoy_num)]);
        }
 
        /* Choose no spell */
@@ -1234,14 +1234,14 @@ bool make_attack_spell(int m_idx)
        if (stupid_monsters)
        {
                /* Only do spells occasionally */
-               if (rand_int(100) >= chance) return (FALSE);
+               if (randint0(100) >= chance) return (FALSE);
        }
        else
        {
-               if (rand_int(100) >=  chance) return (FALSE);
+               if (randint0(100) >=  chance) return (FALSE);
 
                /* Sometimes forbid inate attacks (breaths) */
-               if (rand_int(100) >= (chance * 2)) no_inate = TRUE;
+               if (randint0(100) >= (chance * 2)) no_inate = TRUE;
        }
 
        /* XXX XXX XXX Handle "track_target" option (?) */
@@ -1372,7 +1372,7 @@ bool make_attack_spell(int m_idx)
        /* Hack -- allow "desperate" spells */
        if ((r_ptr->flags2 & (RF2_SMART)) &&
                (m_ptr->hp < m_ptr->maxhp / 10) &&
-               (rand_int(100) < 50))
+               (randint0(100) < 50))
        {
                /* Require intelligent spells */
                f4 &= (RF4_INT_MASK);
@@ -1467,7 +1467,7 @@ bool make_attack_spell(int m_idx)
        if (stupid_monsters)
        {
                /* Choose a spell to cast */
-               thrown_spell = spell[rand_int(num)];
+               thrown_spell = spell[randint0(num)];
        }
        else
        {
@@ -1492,7 +1492,7 @@ bool make_attack_spell(int m_idx)
                if (r_ptr->flags2 & RF2_STUPID) failrate = 0;
 
                /* Check for spell failure (inate attacks never fail) */
-               if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (rand_int(100) < failrate)))
+               if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
                {
                        disturb(1, 0);
                        /* Message */
@@ -2302,7 +2302,7 @@ else msg_format("%^s
                        else msg_format("%^s casts an acid ball.", m_name);
 #endif
 
-                       dam = (randint(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                       dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                        breath(y, x, m_idx, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
                        update_smart_learn(m_idx, DRS_ACID);
                        break;
@@ -2324,7 +2324,7 @@ else msg_format("%^s
                        else msg_format("%^s casts a lightning ball.", m_name);
 #endif
 
-                       dam = (randint(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                       dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                        breath(y, x, m_idx, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
                        update_smart_learn(m_idx, DRS_ELEC);
                        break;
@@ -2364,7 +2364,7 @@ else msg_format("%^s
 #endif
                        }
 
-                       dam = (randint(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                       dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                        breath(y, x, m_idx, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
                        update_smart_learn(m_idx, DRS_FIRE);
                        break;
@@ -2386,7 +2386,7 @@ else msg_format("%^s
                        else msg_format("%^s casts a frost ball.", m_name);
 #endif
 
-                       dam = (randint(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                       dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                        breath(y, x, m_idx, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
                        update_smart_learn(m_idx, DRS_COLD);
                        break;
@@ -2458,7 +2458,7 @@ msg_print("
                        msg_print("You are engulfed in a whirlpool.");
 #endif
 
-                       dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint(rlev * 3) : randint(rlev * 2)) + 50;
+                       dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
                        breath(y, x, m_idx, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
                        break;
                }
@@ -2525,7 +2525,7 @@ msg_format("%^s
 
 
                                /* Attack power */
-                               r1 = (randint(rlev) / 2) + 1;
+                               r1 = (randint1(rlev) / 2) + 1;
 
                                /* Full drain */
                                if (r1 >= p_ptr->csp)
@@ -2603,7 +2603,7 @@ msg_format("%^s
                        }
 
                        dam = damroll(7, 7);
-                       if (rand_int(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
+                       if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2622,12 +2622,12 @@ msg_print("
 
                                if (!p_ptr->resist_conf)
                                {
-                                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                                }
 
                                if (!p_ptr->resist_chaos && one_in_(3))
                                {
-                                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                                       (void)set_image(p_ptr->image + randint0(250) + 150);
                                }
 
                                p_ptr->csp -= 50;
@@ -2669,7 +2669,7 @@ msg_format("%^s
                        }
 
                        dam = damroll(12, 12);
-                       if (rand_int(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
+                       if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2697,26 +2697,26 @@ msg_print("
                                take_hit(DAMAGE_ATTACK, dam, ddesc, MS_BRAIN_SMASH);
                                if (!p_ptr->resist_blind)
                                {
-                                       (void)set_blind(p_ptr->blind + 8 + rand_int(8));
+                                       (void)set_blind(p_ptr->blind + 8 + randint0(8));
                                }
                                if (!p_ptr->resist_conf)
                                {
-                                       (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
                                }
                                if (!p_ptr->free_act)
                                {
-                                       (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+                                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
                                }
-                               (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+                               (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
 
-                               while (rand_int(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
+                               while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
                                        (void)do_dec_stat(A_INT);
-                               while (rand_int(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
+                               while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
                                        (void)do_dec_stat(A_WIS);
 
                                if (!p_ptr->resist_chaos)
                                {
-                                       (void)set_image(p_ptr->image + rand_int(250) + 150);
+                                       (void)set_image(p_ptr->image + randint0(250) + 150);
                                }
                        }
                        break;
@@ -2741,7 +2741,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(3, 8);
-                       if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2777,7 +2777,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(8, 8);
-                       if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2813,7 +2813,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(10, 15);
-                       if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2849,7 +2849,7 @@ else msg_format("%^s
 #endif
 
                        dam = damroll(15, 15);
-                       if ((rand_int(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
+                       if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
                        {
 #ifdef JP
 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3048,7 +3048,7 @@ else msg_format("%^s
                        else msg_format("%^s casts a mana bolt.", m_name);
 #endif
 
-                       dam = randint(rlev * 7 / 2) + 50;
+                       dam = randint1(rlev * 7 / 2) + 50;
                        bolt(m_idx, GF_MANA, dam, MS_BOLT_MANA, learnable);
                        update_smart_learn(m_idx, DRS_REFLECT);
                        break;
@@ -3151,7 +3151,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
@@ -3162,7 +3162,7 @@ msg_print("
                        }
                        else
                        {
-                               (void)set_afraid(p_ptr->afraid + rand_int(4) + 4);
+                               (void)set_afraid(p_ptr->afraid + randint0(4) + 4);
                        }
                        learn_spell(MS_SCARE);
                        update_smart_learn(m_idx, DRS_FEAR);
@@ -3196,7 +3196,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3207,7 +3207,7 @@ msg_print("
                        }
                        else
                        {
-                               (void)set_blind(12 + rand_int(4));
+                               (void)set_blind(12 + randint0(4));
                        }
                        learn_spell(MS_BLIND);
                        update_smart_learn(m_idx, DRS_BLIND);
@@ -3241,7 +3241,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
@@ -3252,7 +3252,7 @@ msg_print("
                        }
                        else
                        {
-                               (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+                               (void)set_confused(p_ptr->confused + randint0(4) + 4);
                        }
                        learn_spell(MS_CONF);
                        update_smart_learn(m_idx, DRS_CONF);
@@ -3280,7 +3280,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3291,7 +3291,7 @@ msg_print("
                        }
                        else
                        {
-                               (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+                               (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
                        }
                        learn_spell(MS_SLOW);
                        update_smart_learn(m_idx, DRS_FREE);
@@ -3325,7 +3325,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3336,7 +3336,7 @@ msg_format("
                        }
                        else
                        {
-                               (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+                               (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
                        }
                        learn_spell(MS_SLEEP);
                        update_smart_learn(m_idx, DRS_FREE);
@@ -3391,7 +3391,7 @@ msg_format("%^s
                        msg_format("%^s invokes the Hand of Doom!", m_name);
 #endif
 
-                       if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3403,7 +3403,7 @@ msg_format("
                        }
                        else
                        {
-                               int dummy = (((s32b) ((40 + randint(20)) * (p_ptr->chp))) / 100);
+                               int dummy = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
 #else
@@ -3544,7 +3544,7 @@ msg_format("%s
                        }
 
                        if (!(m_ptr->invulner))
-                               m_ptr->invulner = randint(4) + 4;
+                               m_ptr->invulner = randint1(4) + 4;
 
                        if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
                        if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
@@ -3630,7 +3630,7 @@ msg_format("%^s
                        if(m_ptr->r_idx == MON_DIO) who = 1;
                        else if(m_ptr->r_idx == MON_WONG) who = 3;
                        dam = who;
-                       if (!process_the_world(randint(2)+2, who, TRUE)) return (FALSE);
+                       if (!process_the_world(randint1(2)+2, who, TRUE)) return (FALSE);
                        break;
                }
 
@@ -3777,7 +3777,7 @@ msg_print("
 #endif
 
                        }
-                       else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3812,7 +3812,7 @@ else msg_format("%^s
                        else msg_format("%^s throw a Psycho-Spear.", m_name);
 #endif
 
-                       dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint(rlev * 2) + 150) : (randint(rlev * 3 / 2) + 100);
+                       dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 150) : (randint1(rlev * 3 / 2) + 100);
                        beam(m_idx, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, learnable);
                        break;
                }
@@ -3881,7 +3881,7 @@ msg_format("%^s
 #endif
 
 
-                       if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+                       if (randint0(100 + rlev/2) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3977,7 +3977,7 @@ else msg_format("%^s
 
                        if(m_ptr->r_idx == MON_ROLENTO)
                        {
-                               int num = 1 + randint(3);
+                               int num = 1 + randint1(3);
                                for (k = 0; k < num; k++)
                                {
                                        count += summon_named_creature(y, x, MON_SHURYUUDAN, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
@@ -3985,7 +3985,7 @@ else msg_format("%^s
                        }
                        else if(m_ptr->r_idx == MON_LOUSY)
                        {
-                               int num = 2 + randint(3);
+                               int num = 2 + randint1(3);
                                for (k = 0; k < num; k++)
                                {
                                        count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, TRUE, FALSE, FALSE, FALSE, FALSE);
@@ -3993,7 +3993,7 @@ else msg_format("%^s
                        }
                        else if(m_ptr->r_idx == MON_BULLGATES)
                        {
-                               int num = 2 + randint(3);
+                               int num = 2 + randint1(3);
                                for (k = 0; k < num; k++)
                                {
                                        count += summon_named_creature(y, x, 921, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
@@ -4001,7 +4001,7 @@ else msg_format("%^s
                        }
                        else if (m_ptr->r_idx == MON_CALDARM)
                        {
-                               int num = randint(3);
+                               int num = randint1(3);
                                for (k = 0; k < num; k++)
                                {
                                        count += summon_named_creature(y, x, 930, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
@@ -4009,7 +4009,7 @@ else msg_format("%^s
                        }
                        else if (m_ptr->r_idx == MON_SERPENT)
                        {
-                               int num = 2 + randint(3);
+                               int num = 2 + randint1(3);
 
                                if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
                                {
index cd60b73..d6cce97 100644 (file)
@@ -200,12 +200,12 @@ bool monst_spell_monst(int m_idx)
        /* Not allowed to cast spells */
        if (!chance) return (FALSE);
 
-       if (rand_int(100) >= chance) return (FALSE);
+       if (randint0(100) >= chance) return (FALSE);
 
        if (p_ptr->inside_battle)
        {
-               start = randint(m_max-1)+m_max;
-               if(rand_int(2)) plus = -1;
+               start = randint1(m_max-1)+m_max;
+               if(randint0(2)) plus = -1;
        }
        else start = m_max + 1;
 
@@ -381,7 +381,7 @@ bool monst_spell_monst(int m_idx)
                /* Hack -- allow "desperate" spells */
                if ((r_ptr->flags2 & RF2_SMART) &&
                        (m_ptr->hp < m_ptr->maxhp / 10) &&
-                       (rand_int(100) < 50))
+                       (randint0(100) < 50))
                {
                        /* Require intelligent spells */
                        f4 &= (RF4_INT_MASK);
@@ -433,7 +433,7 @@ bool monst_spell_monst(int m_idx)
                monster_desc(ddesc, m_ptr, 0x88);
 
                /* Choose a spell to cast */
-               thrown_spell = spell[rand_int(num)];
+               thrown_spell = spell[randint0(num)];
 
                see_t = t_ptr->ml;
                see_either = (see_m || see_t);
@@ -1772,7 +1772,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = (randint(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                               dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                                monst_breath_monst(m_idx, y, x, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
 
                                break;
@@ -1812,7 +1812,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = (randint(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                               dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                                monst_breath_monst(m_idx, y, x, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
 
                                break;
@@ -1869,7 +1869,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = (randint(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                               dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                                monst_breath_monst(m_idx, y, x, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
 
                                break;
@@ -1909,7 +1909,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = (randint(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+                               dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
                                monst_breath_monst(m_idx, y, x, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
 
                                break;
@@ -2035,7 +2035,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint(rlev * 3) : randint(rlev * 2)) + 50;
+                               dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
                                monst_breath_monst(m_idx, y, x, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
 
                                break;
@@ -2125,7 +2125,7 @@ msg_format("%^s
                        case 128+9:
                        {
                                /* Attack power */
-                               int power = (randint(rlev) / 2) + 1;
+                               int power = (randint1(rlev) / 2) + 1;
 
                                if (see_m)
                                {
@@ -2199,7 +2199,7 @@ msg_format("%^s
                                if ((tr_ptr->flags1 & RF1_UNIQUE) ||
                                         (tr_ptr->flags3 & RF3_NO_CONF) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL) ||
-                                        (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
+                                        (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
                                {
                                        /* No obvious effect */
                                        if (see_both)
@@ -2234,7 +2234,7 @@ msg_format("%^s
 
                                        }
 
-                                       t_ptr->confused += rand_int(4) + 4;
+                                       t_ptr->confused += randint0(4) + 4;
 
 #ifdef JP
 mon_take_hit_mon(FALSE, t_idx, dam, &fear, "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£", m_idx);
@@ -2267,7 +2267,7 @@ msg_format("%^s
                                if ((tr_ptr->flags1 & RF1_UNIQUE) ||
                                         (tr_ptr->flags3 & RF3_NO_CONF) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL) ||
-                                        (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
+                                        (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
                                {
                                        /* No obvious effect */
                                        if (see_both)
@@ -2302,9 +2302,9 @@ msg_format("%^s
 
                                        }
 
-                                       t_ptr->confused += rand_int(4) + 4;
+                                       t_ptr->confused += randint0(4) + 4;
                                        t_ptr->slow = MIN(200, t_ptr->slow + 10);
-                                       t_ptr->stunned += rand_int(4) + 4;
+                                       t_ptr->stunned += randint0(4) + 4;
 
 #ifdef JP
 mon_take_hit_mon(FALSE, t_idx, dam, &fear, "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£", m_idx);
@@ -2340,7 +2340,7 @@ msg_format("%^s
                                }
 
                                dam = damroll(3, 8);
-                               if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+                               if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL))
                                {
                                        /* Memorize a flag */
@@ -2391,7 +2391,7 @@ msg_format("%^s
                                }
 
                                dam = damroll(8, 8);
-                               if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+                               if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL))
                                {
                                        /* Memorize a flag */
@@ -2442,7 +2442,7 @@ msg_format("%^s
                                }
 
                                dam = damroll(10, 15);
-                               if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+                               if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL))
                                {
                                        /* Memorize a flag */
@@ -2493,7 +2493,7 @@ msg_format("%^s
                                }
 
                                dam = damroll(15, 15);
-                               if (((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) && (m_ptr->r_idx != MON_KENSHIROU)) ||
+                               if (((randint0(100 + rlev/2) < (tr_ptr->level + 35)) && (m_ptr->r_idx != MON_KENSHIROU)) ||
                                         (tr_ptr->flags3 & RF3_RES_ALL))
                                {
                                        /* Memorize a flag */
@@ -2745,7 +2745,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = randint(rlev * 7 / 2) + 50;
+                               dam = randint1(rlev * 7 / 2) + 50;
                                monst_bolt_monst(m_idx, y, x, GF_MANA,
                                        dam, MS_BOLT_MANA, learnable);
 
@@ -2862,7 +2862,7 @@ if (see_t) msg_format("%^s
 #endif
 
                                }
-                               else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+                               else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
                                {
 #ifdef JP
 if (see_t) msg_format("%^s¤Ï¶²Éݤò´¶¤¸¤Ê¤¤¡£", t_name);
@@ -2875,7 +2875,7 @@ if (see_t) msg_format("%^s
                                {
                                        if (!t_ptr->monfear) fear = TRUE;
 
-                                       t_ptr->monfear += rand_int(4) + 4;
+                                       t_ptr->monfear += randint0(4) + 4;
                                }
 
                                wake_up = TRUE;
@@ -2914,7 +2914,7 @@ if (see_t) msg_format("%^s
 #endif
 
                                }
-                               else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+                               else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
                                {
 #ifdef JP
 if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
@@ -2932,7 +2932,7 @@ if (see_t)   msg_format("%^s
 #endif
 
 
-                                       t_ptr->confused += 12 + (byte)rand_int(4);
+                                       t_ptr->confused += 12 + (byte)randint0(4);
                                }
 
                                wake_up = TRUE;
@@ -2969,7 +2969,7 @@ if (see_t) msg_format("%^s
 #endif
 
                                }
-                               else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+                               else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
                                {
 #ifdef JP
 if (see_t) msg_format("%^s¤ÏÏǤ蘆¤ì¤Ê¤«¤Ã¤¿¡£", t_name);
@@ -2987,7 +2987,7 @@ if (see_t) msg_format("%^s
 #endif
 
 
-                                       t_ptr->confused += 12 + (byte)rand_int(4);
+                                       t_ptr->confused += 12 + (byte)randint0(4);
                                }
 
                                wake_up = TRUE;
@@ -3025,7 +3025,7 @@ if (see_t) msg_format("%^s
 #endif
 
                                }
-                               else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+                               else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
                                {
 #ifdef JP
 if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
@@ -3083,7 +3083,7 @@ if (see_t) msg_format("%^s
 #endif
 
                                }
-                               else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+                               else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
                                {
 #ifdef JP
 if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
@@ -3101,7 +3101,7 @@ if (see_t) msg_format("%^s
 #endif
 
 
-                                       t_ptr->stunned += randint(4) + 4;
+                                       t_ptr->stunned += randint1(4) + 4;
                                }
 
                                wake_up = TRUE;
@@ -3181,11 +3181,11 @@ if (see_both) msg_format("
                                }
                                else
                                {
-                                       if ((r_ptr->level + randint(20)) >
-                                               (tr_ptr->level + 10 + randint(20)))
+                                       if ((r_ptr->level + randint1(20)) >
+                                               (tr_ptr->level + 10 + randint1(20)))
                                        {
                                                t_ptr->hp = t_ptr->hp -
-                                                 (((s32b)((40 + randint(20)) * t_ptr->hp)) / 100);
+                                                 (((s32b)((40 + randint1(20)) * t_ptr->hp)) / 100);
 
                                                if (t_ptr->hp < 1) t_ptr->hp = 1;
                                        }
@@ -3313,7 +3313,7 @@ msg_format("%s
                                        }
                                }
 
-                               if (!m_ptr->invulner) m_ptr->invulner = randint(4) + 4;
+                               if (!m_ptr->invulner) m_ptr->invulner = randint1(4) + 4;
 
                                if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
                                if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
@@ -3405,7 +3405,7 @@ msg_format("%^s
                                if(m_ptr->r_idx = MON_DIO) who = 1;
                                else if(m_ptr->r_idx = MON_WONG) who = 3;
                                dam = who;
-                               if(!process_the_world(randint(2)+2, who, los(py, px, m_ptr->fy, m_ptr->fx))) return (FALSE);
+                               if(!process_the_world(randint1(2)+2, who, los(py, px, m_ptr->fy, m_ptr->fx))) return (FALSE);
 #endif
                                break;
                        }
@@ -3475,7 +3475,7 @@ msg_format("%^s
 
                                                resists_tele = TRUE;
                                        }
-                                       else if (tr_ptr->level > randint(100))
+                                       else if (tr_ptr->level > randint1(100))
                                        {
                                                if (see_t)
                                                {
@@ -3528,7 +3528,7 @@ msg_format("%^s
                                        }
                                }
 
-                               dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint(rlev * 2) + 180) : (randint(rlev * 3 / 2) + 120);
+                               dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 180) : (randint1(rlev * 3 / 2) + 120);
                                monst_beam_monst(m_idx, y, x, GF_PSY_SPEAR,
                                        dam, MS_PSY_SPEAR, learnable);
                                break;
@@ -3661,7 +3661,7 @@ msg_format("%s
 
                                if(m_ptr->r_idx == MON_ROLENTO)
                                {
-                                       int num = 1 + randint(3);
+                                       int num = 1 + randint1(3);
                                        for (k = 0; k < num; k++)
                                        {
                                                count += summon_named_creature(y, x, MON_SHURYUUDAN, FALSE, FALSE, is_friendly(m_ptr), pet);
@@ -3669,7 +3669,7 @@ msg_format("%s
                                }
                                else if(m_ptr->r_idx == MON_LOUSY)
                                {
-                                       int num = 2 + randint(3);
+                                       int num = 2 + randint1(3);
                                        for (k = 0; k < num; k++)
                                        {
                                                count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, TRUE, friendly, pet, FALSE, FALSE);
@@ -3677,7 +3677,7 @@ msg_format("%s
                                }
                                else if(m_ptr->r_idx == MON_BULLGATES)
                                {
-                                       int num = 2 + randint(3);
+                                       int num = 2 + randint1(3);
                                        for (k = 0; k < num; k++)
                                        {
                                                count += summon_named_creature(y, x, 921, FALSE, FALSE, is_friendly(m_ptr), FALSE);
@@ -3685,7 +3685,7 @@ msg_format("%s
                                }
                                else if (m_ptr->r_idx == MON_CALDARM)
                                {
-                                       int num = randint(3);
+                                       int num = randint1(3);
                                        for (k = 0; k < num; k++)
                                        {
                                                count += summon_named_creature(y, x, 930, FALSE, FALSE, is_friendly(m_ptr), FALSE);
@@ -3693,7 +3693,7 @@ msg_format("%s
                                }
                                else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
                                {
-                                       int num = 2 + randint(3);
+                                       int num = 2 + randint1(3);
                                        for (k = 0; k < num; k++)
                                        {
                                                count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, TRUE, friendly, pet, TRUE, FALSE);
index 8d20767..c346858 100644 (file)
@@ -733,7 +733,7 @@ static bool cast_learned_spell(int spell, bool success)
 {
        int             dir;
        int             plev = pseudo_plev();
-       int     summon_lev = p_ptr->lev * 2 / 3 + randint(p_ptr->lev/2);
+       int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
        int             hp = p_ptr->chp;
        int             damage = 0;
        bool    unique_okay = FALSE;
@@ -741,7 +741,7 @@ static bool cast_learned_spell(int spell, bool success)
        bool   not_pet = (bool)(!pet);
        bool   no_trump = FALSE;
 
-       if (!success || (randint(50+plev) < plev/10)) unique_okay = TRUE;
+       if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
 
        /* spell code */
        switch (spell)
@@ -1103,7 +1103,7 @@ else msg_print("
 #else
                        else msg_print("You cast an acid ball.");
 #endif
-               damage = randint(plev * 6) + 15;
+               damage = randint1(plev * 6) + 15;
                fire_ball(GF_ACID, dir, damage, 2);
                break;
        case MS_BALL_ELEC:
@@ -1113,7 +1113,7 @@ else msg_print("
 #else
                        else msg_print("You cast a lightning ball.");
 #endif
-               damage = randint(plev * 3) + 8;
+               damage = randint1(plev * 3) + 8;
                fire_ball(GF_ELEC, dir, damage, 2);
                break;
        case MS_BALL_FIRE:
@@ -1123,7 +1123,7 @@ else msg_print("
 #else
                        else msg_print("You cast a fire ball.");
 #endif
-               damage = randint(plev * 7) + 10;
+               damage = randint1(plev * 7) + 10;
                fire_ball(GF_FIRE, dir, damage, 2);
                break;
        case MS_BALL_COLD:
@@ -1133,7 +1133,7 @@ else msg_print("
 #else
                        else msg_print("You cast a frost ball.");
 #endif
-               damage = randint(plev * 3) + 10;
+               damage = randint1(plev * 3) + 10;
                fire_ball(GF_COLD, dir, damage, 2);
                break;
        case MS_BALL_POIS:
@@ -1163,7 +1163,7 @@ else msg_print("ή
 #else
                        else msg_print("You gesture fluidly.");
 #endif
-               damage = randint(plev * 4) + 50;
+               damage = randint1(plev * 4) + 50;
                fire_ball(GF_WATER, dir, damage, 4);
                break;
        case MS_BALL_MANA:
@@ -1188,7 +1188,7 @@ else msg_print("
                break;
        case MS_DRAIN_MANA:
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball_hide(GF_DRAIN_MANA, dir, randint(plev)+plev, 0);
+               fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev)+plev, 0);
                break;
        case MS_MIND_BLAST:
                if (!get_aim_dir(&dir)) return FALSE;
@@ -1298,7 +1298,7 @@ else msg_print("
 #else
                        else msg_print("You cast a mana bolt.");
 #endif
-               damage = randint(plev * 7) + 50;
+               damage = randint1(plev * 7) + 50;
                fire_bolt(GF_MANA, dir, damage);
                break;
        case MS_BOLT_PLASMA:
@@ -1362,7 +1362,7 @@ else msg_print("Ͷ
                sleep_monster(dir);
                break;
        case MS_SPEED:
-               (void)set_fast(randint(20 + plev) + plev, FALSE);
+               (void)set_fast(randint1(20 + plev) + plev, FALSE);
                break;
        case MS_HAND_DOOM:
        {
@@ -1392,7 +1392,7 @@ msg_print("̵
 #else
                        msg_print("You cast a Globe of Invulnerability.");
 #endif
-               (void)set_invuln(randint(4) + 4, FALSE);
+               (void)set_invuln(randint1(4) + 4, FALSE);
                break;
        case MS_BLINK:
                teleport_player(10);
@@ -1409,7 +1409,7 @@ msg_print("̵
 #endif
                msg_print(NULL);
 
-               p_ptr->energy += (randint(200)+1200);
+               p_ptr->energy += (randint1(200)+1200);
 
                /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
@@ -1449,7 +1449,7 @@ msg_format("%s
 
                                break;
                        }
-                       else if (r_ptr->level > randint(100))
+                       else if (r_ptr->level > randint1(100))
                        {
                                r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -1493,7 +1493,7 @@ msg_format("%s
                        msg_format("You gesture at %s's feet.", m_name);
 #endif
 
-               if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint(50) > plev + randint(60)))
+               if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
                {
 #ifdef JP
 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
@@ -1530,7 +1530,7 @@ else msg_print("
 #else
                        else msg_print("You throw a psycho-spear.");
 #endif
-               damage = randint(plev * 3) + 100;
+               damage = randint1(plev * 3) + 100;
                (void)fire_beam(GF_PSY_SPEAR, dir, damage);
                break;
        case MS_DARKNESS:
@@ -2083,7 +2083,7 @@ if (!get_check("
        chance = MAX(chance,0);
 
        /* Failed spell */
-       if (rand_int(100) < chance)
+       if (randint0(100) < chance)
        {
                if (flush_failure) flush();
 #ifdef JP
@@ -2131,14 +2131,14 @@ msg_print("
 
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                chg_virtue(V_KNOWLEDGE, -10);
 
                /* Damage CON (possibly permanently) */
-               if (rand_int(100) < 50)
+               if (randint0(100) < 50)
                {
-                       bool perm = (rand_int(100) < 25);
+                       bool perm = (randint0(100) < 25);
 
                        /* Message */
 #ifdef JP
@@ -2149,7 +2149,7 @@ msg_print("
 
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_CON, 15 + randint(10), perm);
+                       (void)dec_stat(A_CON, 15 + randint1(10), perm);
                }
        }
 
@@ -2169,7 +2169,7 @@ void learn_spell(int monspell)
        if (p_ptr->action != ACTION_LEARN) return;
        if (p_ptr->magic_num2[monspell]) return;
        if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
-       if (randint(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
+       if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
        {
                p_ptr->magic_num2[monspell] = 1;
 #ifdef JP
index 082daac..1d34866 100644 (file)
@@ -25,7 +25,7 @@ bool gain_random_mutation(int choose_mut)
 
        while (attempts_left--)
        {
-               switch (choose_mut ? choose_mut : (p_ptr->pclass == CLASS_BERSERKER ? 74+randint(119) : randint(193)))
+               switch (choose_mut ? choose_mut : (p_ptr->pclass == CLASS_BERSERKER ? 74+randint1(119) : randint1(193)))
                {
                case 1: case 2: case 3: case 4:
                        muta_class = &(p_ptr->muta1);
@@ -1023,7 +1023,7 @@ msg_print("
 
                if (p_ptr->prace == RACE_VAMPIRE &&
                  !(p_ptr->muta1 & MUT1_HYPN_GAZE) &&
-                  (randint(10) < 7))
+                  (randint1(10) < 7))
                {
                        muta_class = &(p_ptr->muta1);
                        muta_which = MUT1_HYPN_GAZE;
@@ -1037,7 +1037,7 @@ muta_desc = "
 
                else if (p_ptr->prace == RACE_IMP &&
                        !(p_ptr->muta2 & MUT2_HORNS) &&
-                       (randint(10) < 7))
+                       (randint1(10) < 7))
                {
                        muta_class = &(p_ptr->muta2);
                        muta_which = MUT2_HORNS;
@@ -1051,7 +1051,7 @@ muta_desc = "
 
                else if (p_ptr->prace == RACE_YEEK &&
                        !(p_ptr->muta1 & MUT1_SHRIEK) &&
-                       (randint(10) < 7))
+                       (randint1(10) < 7))
                {
                        muta_class = &(p_ptr->muta1);
                        muta_which = MUT1_SHRIEK;
@@ -1065,7 +1065,7 @@ muta_desc = "
 
                else if (p_ptr->prace == RACE_BEASTMAN &&
                        !(p_ptr->muta1 & MUT1_POLYMORPH) &&
-                       (randint(10) < 2))
+                       (randint1(10) < 2))
                {
                        muta_class = &(p_ptr->muta1);
                        muta_which = MUT1_POLYMORPH;
@@ -1079,7 +1079,7 @@ muta_desc = "
 
                else if (p_ptr->prace == RACE_MIND_FLAYER &&
                        !(p_ptr->muta2 & MUT2_TENTACLES) &&
-                       (randint(10) < 7))
+                       (randint1(10) < 7))
                {
                        muta_class = &(p_ptr->muta2);
                        muta_which = MUT2_TENTACLES;
@@ -1330,7 +1330,7 @@ bool lose_mutation(int choose_mut)
 
        while (attempts_left--)
        {
-               switch (choose_mut ? choose_mut : randint(193))
+               switch (choose_mut ? choose_mut : randint1(193))
                {
                case 1: case 2: case 3: case 4:
                        muta_class = &(p_ptr->muta1);
@@ -3628,7 +3628,7 @@ msg_print("
                case MUT1_BERSERK:
                        if (racial_aux(8, 8, A_STR, 14))
                        {
-                               (void)set_shero(randint(25) + 25, FALSE);
+                               (void)set_shero(randint1(25) + 25, FALSE);
                                (void)hp_player(30);
                                (void)set_afraid(0);
                        }
@@ -3669,24 +3669,24 @@ msg_print("
                        if (racial_aux(10, 12, A_CON, 12))
                        {
                                int num = lvl / 10;
-                               int dur = randint(20) + 20;
+                               int dur = randint1(20) + 20;
 
-                               if (rand_int(5) < num)
+                               if (randint0(5) < num)
                                {
                                        (void)set_oppose_acid(dur, FALSE);
                                        num--;
                                }
-                               if (rand_int(4) < num)
+                               if (randint0(4) < num)
                                {
                                        (void)set_oppose_elec(dur, FALSE);
                                        num--;
                                }
-                               if (rand_int(3) < num)
+                               if (randint0(3) < num)
                                {
                                        (void)set_oppose_fire(dur, FALSE);
                                        num--;
                                }
-                               if (rand_int(2) < num)
+                               if (randint0(2) < num)
                                {
                                        (void)set_oppose_cold(dur, FALSE);
                                        num--;
@@ -3726,10 +3726,10 @@ msg_print("
                                /* Fake a population explosion. */
 #ifdef JP
 msg_print("ÆÍÁ³Æ¬¤¬Äˤ¯¤Ê¤Ã¤¿¡ª");
-take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "¶ØÍߤò¶¯¤¤¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, "¶ØÍߤò¶¯¤¤¤¿ÈèÏ«", -1);
 #else
                                msg_print("You suddenly have a headache!");
-                               take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "the strain of forcing abstinence", -1);
+                               take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, "the strain of forcing abstinence", -1);
 #endif
 
                                num_repro += MAX_REPRO;
@@ -3747,7 +3747,7 @@ take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "
                                if (cave[y][x].m_idx)
                                {
                                        py_attack(y, x, 0);
-                                       if (rand_int(p_ptr->skill_dis) < 7)
+                                       if (randint0(p_ptr->skill_dis) < 7)
 #ifdef JP
 msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
 #else
@@ -3823,7 +3823,7 @@ msg_print("
                                    !(r_ptr->flags1 & RF1_QUESTOR) &&
                                    !(r_ptr->flags1 & RF1_UNIQUE) &&
                                    !p_ptr->inside_arena && !p_ptr->inside_quest &&
-                                       (r_ptr->level < randint(p_ptr->lev+50)) &&
+                                       (r_ptr->level < randint1(p_ptr->lev+50)) &&
                                        !(m_ptr->mflag2 & MFLAG_NOGENO))
                                {
                                        /* Delete the monster, rather than killing it. */
index 7aedf3a..44d51e0 100644 (file)
@@ -374,7 +374,7 @@ void compact_objects(int size)
                                x = m_ptr->fx;
 
                                /* Monsters protect their objects */
-                               if (rand_int(100) < 90) continue;
+                               if (randint0(100) < 90) continue;
                        }
 
                        /* Dungeon */
@@ -396,7 +396,7 @@ void compact_objects(int size)
                            (cnt < 1000)) chance = 100;
 
                        /* Apply the saving throw */
-                       if (rand_int(100) < chance) continue;
+                       if (randint0(100) < chance) continue;
 
                        /* Delete the object */
                        delete_object_idx(i);
@@ -623,7 +623,7 @@ s16b get_obj_num(int level)
                if (one_in_(GREAT_OBJ))
                {
                        /* What a bizarre calculation */
-                       level = 1 + (level * MAX_DEPTH / randint(MAX_DEPTH));
+                       level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
                }
        }
 
@@ -660,7 +660,7 @@ s16b get_obj_num(int level)
 
 
        /* Pick an object */
-       value = rand_int(total);
+       value = randint0(total);
 
        /* Find the object */
        for (i = 0; i < alloc_kind_size; i++)
@@ -674,7 +674,7 @@ s16b get_obj_num(int level)
 
 
        /* Power boost */
-       p = rand_int(100);
+       p = randint0(100);
 
        /* Try for a "better" object once (50%) or twice (10%) */
        if (p < 60)
@@ -683,7 +683,7 @@ s16b get_obj_num(int level)
                j = i;
 
                /* Pick a object */
-               value = rand_int(total);
+               value = randint0(total);
 
                /* Find the object */
                for (i = 0; i < alloc_kind_size; i++)
@@ -706,7 +706,7 @@ s16b get_obj_num(int level)
                j = i;
 
                /* Pick a object */
-               value = rand_int(total);
+               value = randint0(total);
 
                /* Find the object */
                for (i = 0; i < alloc_kind_size; i++)
@@ -1924,7 +1924,7 @@ s16b m_bonus(int max, int level)
        extra = ((max * level) % MAX_DEPTH);
 
        /* Hack -- simulate floating point computations */
-       if (rand_int(MAX_DEPTH) < extra) bonus++;
+       if (randint0(MAX_DEPTH) < extra) bonus++;
 
 
        /* The "stand" is equal to one quarter of the max */
@@ -1934,7 +1934,7 @@ s16b m_bonus(int max, int level)
        extra = (max % 4);
 
        /* Hack -- simulate floating point computations */
-       if (rand_int(4) < extra) stand++;
+       if (randint0(4) < extra) stand++;
 
 
        /* Choose an "interesting" value */
@@ -2176,7 +2176,7 @@ static byte get_random_ego(byte slot, bool good, int level)
                }
        }
 
-       value = randint(total);
+       value = randint1(total);
 
        for (i = 1; i < max_e_idx; i++)
        {
@@ -2204,8 +2204,8 @@ static byte get_random_ego(byte slot, bool good, int level)
  */
 static void a_m_aux_1(object_type *o_ptr, int level, int power)
 {
-       int tohit1 = randint(5) + m_bonus(5, level);
-       int todam1 = randint(5) + m_bonus(5, level);
+       int tohit1 = randint1(5) + m_bonus(5, level);
+       int todam1 = randint1(5) + m_bonus(5, level);
 
        int tohit2 = m_bonus(10, level);
        int todam2 = m_bonus(10, level);
@@ -2274,7 +2274,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        else if (power < -1)
                        {
                                /* Hack -- Horrible digging bonus */
-                               o_ptr->pval = 0 - (5 + randint(5));
+                               o_ptr->pval = 0 - (5 + randint1(5));
                        }
 
                        /* Bad */
@@ -2320,22 +2320,22 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                                case EGO_DF:
                                        if (one_in_(3))
                                                o_ptr->art_flags2 |= TR2_RES_POIS;
-                                       random_resistance(o_ptr, FALSE, randint(22)+16);
+                                       random_resistance(o_ptr, FALSE, randint1(22)+16);
                                        break;
                                case EGO_SLAY_DRAGON:
-                                       random_resistance(o_ptr, FALSE, randint(12) + 4);
+                                       random_resistance(o_ptr, FALSE, randint1(12) + 4);
                                        break;
                                case EGO_KILL_DRAGON:
-                                       random_resistance(o_ptr, FALSE, randint(12) + 4);
+                                       random_resistance(o_ptr, FALSE, randint1(12) + 4);
                                        if (one_in_(3))
                                                o_ptr->art_flags2 |= TR2_RES_POIS;
-                                       random_resistance(o_ptr, FALSE, randint(14) + 4);
+                                       random_resistance(o_ptr, FALSE, randint1(14) + 4);
                                case EGO_WEST:
                                        if (one_in_(3))
                                                o_ptr->art_flags2 |= TR2_RES_FEAR;
                                        break;
                                case EGO_CHAOTIC:
-                                       random_resistance(o_ptr, FALSE, (randint(34) + 4));
+                                       random_resistance(o_ptr, FALSE, (randint1(34) + 4));
                                        break;
                                case EGO_SLAYING_WEAPON:
                                        if (one_in_(3)) /* double damage */
@@ -2365,7 +2365,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                                        }
                                        break;
                                case EGO_TRUMP:
-                                       random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                       random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                        if (one_in_(5))
                                                o_ptr->art_flags1 |= TR1_SLAY_DEMON;
                                        break;
@@ -2376,7 +2376,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                                                o_ptr->art_flags1 |= TR1_DEX;
                                        if (one_in_(5))
                                                o_ptr->art_flags2 |= TR2_RES_FEAR;
-                                       random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                       random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                        break;
                                case EGO_SHARPNESS:
                                        o_ptr->pval = m_bonus(5, level) + 1;
@@ -2403,7 +2403,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        else if (power < -1)
                        {
                                /* Roll for ego-item */
-                               if (rand_int(MAX_DEPTH) < level)
+                               if (randint0(MAX_DEPTH) < level)
                                {
                                        o_ptr->name2 = get_random_ego(INVEN_RARM, FALSE, level);
                                        switch (o_ptr->name2)
@@ -2469,7 +2469,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        else if (power < -1)
                        {
                                /* Roll for ego-item */
-                               if (rand_int(MAX_DEPTH) < level)
+                               if (randint0(MAX_DEPTH) < level)
                                {
                                        o_ptr->name2 = get_random_ego(INVEN_AMMO, FALSE, level);
                                }
@@ -2488,9 +2488,9 @@ static void dragon_resist(object_type * o_ptr)
                artifact_bias = 0;
 
                if (one_in_(4))
-                       random_resistance(o_ptr, FALSE, (randint(14) + 4));
+                       random_resistance(o_ptr, FALSE, (randint1(14) + 4));
                else
-                       random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                       random_resistance(o_ptr, FALSE, (randint1(22) + 16));
        }
        while (one_in_(2));
 }
@@ -2504,7 +2504,7 @@ static void dragon_resist(object_type * o_ptr)
  */
 static void a_m_aux_2(object_type *o_ptr, int level, int power)
 {
-       int toac1 = randint(5) + m_bonus(5, level);
+       int toac1 = randint1(5) + m_bonus(5, level);
 
        int toac2 = m_bonus(10, level);
 
@@ -2567,7 +2567,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                /* Hack -- Try for "Robes of the Magi" */
                                if ((o_ptr->tval == TV_SOFT_ARMOR) &&
                                    (o_ptr->sval == SV_ROBE) &&
-                                   (rand_int(100) < 15))
+                                   (randint0(100) < 15))
                                {
                                        if (one_in_(5))
                                        {
@@ -2599,7 +2599,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                        case EGO_RESISTANCE:
                                                if (one_in_(4))
                                                        o_ptr->art_flags2 |= TR2_RES_POIS;
-                                               random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                               random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                                break;
                                        case EGO_DWARVEN:
                                                if (o_ptr->tval != TV_HARD_ARMOR)
@@ -2650,7 +2650,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                switch (o_ptr->name2)
                                {
                                case EGO_ENDURANCE:
-                                       random_resistance(o_ptr, FALSE, (randint(34) + 4));
+                                       random_resistance(o_ptr, FALSE, (randint1(34) + 4));
                                        if (one_in_(4)) o_ptr->art_flags2 |= TR2_RES_POIS;
                                        break;
                                case EGO_REFLECTION:
@@ -2686,7 +2686,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                switch (o_ptr->name2)
                                {
                                case EGO_POWER:
-                                       random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                       random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                        break;
                                }
                        }
@@ -2727,7 +2727,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                case EGO_SLOW_DESCENT:
                                        if (one_in_(2))
                                        {
-                                               random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                               random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                        }
                                        break;
                                }
@@ -2759,16 +2759,16 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                        switch (o_ptr->name2)
                                        {
                                        case EGO_MAGI:
-                                               random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                               random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                                break;
                                        case EGO_MIGHT:
-                                               random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                               random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                                break;
                                        case EGO_TELEPATHY:
                                        case EGO_REGENERATION:
                                                break;
                                        case EGO_LORDLINESS:
-                                               random_resistance(o_ptr, FALSE, (randint(22) + 16));
+                                               random_resistance(o_ptr, FALSE, (randint1(22) + 16));
                                                break;
                                        case EGO_SEEING:
                                                if (one_in_(3)) o_ptr->art_flags3 |= TR3_TELEPATHY;
@@ -2847,7 +2847,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                case TV_CLOAK:
                {
                        if (o_ptr->sval == SV_ELVEN_CLOAK)
-                               o_ptr->pval = randint(4); /* No cursed elven cloaks...? */
+                               o_ptr->pval = randint1(4); /* No cursed elven cloaks...? */
 
                        /* Very good */
                        if (power > 1)
@@ -2958,10 +2958,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_SPEED:
                                {
                                        /* Base speed (1 to 10) */
-                                       o_ptr->pval = randint(5) + m_bonus(5, level);
+                                       o_ptr->pval = randint1(5) + m_bonus(5, level);
 
                                        /* Super-charge the ring */
-                                       while (rand_int(100) < 50) o_ptr->pval++;
+                                       while (randint0(100) < 50) o_ptr->pval++;
 
                                        /* Cursed Ring */
                                        if (power < 0)
@@ -2991,12 +2991,12 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                {
                                        do
                                        {
-                                               random_resistance(o_ptr, FALSE, randint(20) + 18);
+                                               random_resistance(o_ptr, FALSE, randint1(20) + 18);
                                        }
                                        while (one_in_(4));
 
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 10 + randint(5) + m_bonus(10, level);
+                                       o_ptr->to_a = 10 + randint1(5) + m_bonus(10, level);
                                        rating += 15;
                                }
                                break;
@@ -3030,7 +3030,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_ELEC:
                                {
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 5 + randint(5) + m_bonus(10, level);
+                                       o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level);
                                        break;
                                }
 
@@ -3072,7 +3072,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_DAMAGE:
                                {
                                        /* Bonus to damage */
-                                       o_ptr->to_d = 1 + randint(5) + m_bonus(16, level);
+                                       o_ptr->to_d = 1 + randint1(5) + m_bonus(16, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3094,7 +3094,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_ACCURACY:
                                {
                                        /* Bonus to hit */
-                                       o_ptr->to_h = 1 + randint(5) + m_bonus(16, level);
+                                       o_ptr->to_h = 1 + randint1(5) + m_bonus(16, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3116,7 +3116,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_PROTECTION:
                                {
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 5 + randint(8) + m_bonus(10, level);
+                                       o_ptr->to_a = 5 + randint1(8) + m_bonus(10, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3138,8 +3138,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_SLAYING:
                                {
                                        /* Bonus to damage and to hit */
-                                       o_ptr->to_d = randint(5) + m_bonus(12, level);
-                                       o_ptr->to_h = randint(5) + m_bonus(12, level);
+                                       o_ptr->to_d = randint1(5) + m_bonus(12, level);
+                                       o_ptr->to_h = randint1(5) + m_bonus(12, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3202,7 +3202,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                {
                                        int tmp = m_bonus(10, level);
                                        object_kind *k_ptr = &k_info[o_ptr->k_idx];
-                                       switch(randint(28))
+                                       switch(randint1(28))
                                        {
                                        case 1: case 2:
                                                o_ptr->name2 = EGO_RING_THROW;
@@ -3286,7 +3286,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                                        else
                                                        {
                                                                o_ptr->name2 = EGO_RING_BERSERKER;
-                                                               o_ptr->to_h -= 2+randint(4);
+                                                               o_ptr->to_h -= 2+randint1(4);
                                                        }
                                                        break;
                                                case SV_RING_PROTECTION:
@@ -3314,8 +3314,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                                        break;
                                                case SV_RING_LORDLY:
                                                        if (!one_in_(20)) break;
-                                                       random_resistance(o_ptr, FALSE, randint(20) + 18);
-                                                       random_resistance(o_ptr, FALSE, randint(20) + 18);
+                                                       random_resistance(o_ptr, FALSE, randint1(20) + 18);
+                                                       random_resistance(o_ptr, FALSE, randint1(20) + 18);
                                                        o_ptr->name2 = EGO_RING_TRUE;
                                                        break;
                                                case SV_RING_SUSTAIN:
@@ -3360,7 +3360,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                while(!o_ptr->name2)
                                {
                                        object_kind *k_ptr = &k_info[o_ptr->k_idx];
-                                       switch(randint(5))
+                                       switch(randint1(5))
                                        {
                                        case 1:
                                                if (k_ptr->flags3 & TR3_DRAIN_EXP) break;
@@ -3452,7 +3452,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
 
                                case SV_AMULET_RESISTANCE:
                                {
-                                       if (one_in_(3)) random_resistance(o_ptr, FALSE, (randint(34) + 4));
+                                       if (one_in_(3)) random_resistance(o_ptr, FALSE, (randint1(34) + 4));
                                        if (one_in_(5)) o_ptr->art_flags2 |= TR2_RES_POIS;
                                }
                                break;
@@ -3460,7 +3460,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                /* Amulet of searching */
                                case SV_AMULET_SEARCHING:
                                {
-                                       o_ptr->pval = randint(2) + m_bonus(4, level);
+                                       o_ptr->pval = randint1(2) + m_bonus(4, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3481,8 +3481,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                /* Amulet of the Magi -- never cursed */
                                case SV_AMULET_THE_MAGI:
                                {
-                                       o_ptr->pval = randint(5) + m_bonus(5, level);
-                                       o_ptr->to_a = randint(5) + m_bonus(5, level);
+                                       o_ptr->pval = randint1(5) + m_bonus(5, level);
+                                       o_ptr->to_a = randint1(5) + m_bonus(5, level);
 
                                        /* Boost the rating */
                                        rating += 15;
@@ -3503,8 +3503,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        o_ptr->ident |= (IDENT_CURSED);
 
                                        /* Penalize */
-                                       o_ptr->pval = 0 - (randint(5) + m_bonus(5, level));
-                                       o_ptr->to_a = 0 - (randint(5) + m_bonus(5, level));
+                                       o_ptr->pval = 0 - (randint1(5) + m_bonus(5, level));
+                                       o_ptr->to_a = 0 - (randint1(5) + m_bonus(5, level));
                                        if (power > 0) power = 0 - power;
 
                                        break;
@@ -3541,7 +3541,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                while(!o_ptr->name2)
                                {
                                        object_kind *k_ptr = &k_info[o_ptr->k_idx];
-                                       switch(randint(21))
+                                       switch(randint1(21))
                                        {
                                        case 1: case 2:
                                                if (k_ptr->flags3 & TR3_SLOW_DIGEST) break;
@@ -3651,7 +3651,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                while(!o_ptr->name2)
                                {
                                        object_kind *k_ptr = &k_info[o_ptr->k_idx];
-                                       switch(randint(5))
+                                       switch(randint1(5))
                                        {
                                        case 1:
                                                if (k_ptr->flags3 & TR3_DRAIN_EXP) break;
@@ -3743,14 +3743,14 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* Hack -- Torches -- random fuel */
                        if (o_ptr->sval == SV_LITE_TORCH)
                        {
-                               if (o_ptr->pval > 0) o_ptr->xtra4 = randint(o_ptr->pval);
+                               if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
                                o_ptr->pval = 0;
                        }
 
                        /* Hack -- Lanterns -- random fuel */
                        if (o_ptr->sval == SV_LITE_LANTERN)
                        {
-                               if (o_ptr->pval > 0) o_ptr->xtra4 = randint(o_ptr->pval);
+                               if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
                                o_ptr->pval = 0;
                        }
 
@@ -3796,7 +3796,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* The wand or staff gets a number of initial charges equal
                         * to between 1/2 (+1) and the full object kind's pval. -LM-
                         */
-                       o_ptr->pval = k_ptr->pval / 2 + randint((k_ptr->pval + 1) / 2);
+                       o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
                        break;
                }
 
@@ -3825,7 +3825,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* Pick a random non-unique monster race */
                        while (1)
                        {
-                               i = randint(max_r_idx - 1);
+                               i = randint1(max_r_idx - 1);
 
                                if (!item_monster_okay(i)) continue;
                                if (i == MON_TSUCHINOKO) continue;
@@ -3838,7 +3838,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                                if (!r_ptr->rarity) continue;
 
                                /* Prefer less out-of-depth monsters */
-                               if (rand_int(check)) continue;
+                               if (randint0(check)) continue;
 
                                break;
                        }
@@ -3900,7 +3900,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                                if (!(r_ptr->flags9 & match)) continue;
 
                                /* Prefer less out-of-depth monsters */
-                               if (rand_int(check)) continue;
+                               if (randint0(check)) continue;
 
                                break;
                        }
@@ -3932,7 +3932,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* Pick a random monster race */
                        while (1)
                        {
-                               i = randint(max_r_idx - 1);
+                               i = randint1(max_r_idx - 1);
 
                                r_ptr = &r_info[i];
 
@@ -3967,13 +3967,13 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        if (obj_level <= 0) break;
 
                        /* Hack -- pick a "difficulty" */
-                       o_ptr->pval = randint(obj_level);
+                       o_ptr->pval = randint1(obj_level);
                        if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6;
 
                        o_ptr->xtra3 = dun_level + 5;
 
                        /* Never exceed "difficulty" of 55 to 59 */
-                       if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)rand_int(5);
+                       if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5);
 
                        break;
                }
@@ -4017,7 +4017,7 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
 
        int i, rolls, f1, f2, power;
 
-       if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += rand_int(p_ptr->lev/2+10);
+       if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += randint0(p_ptr->lev/2+10);
 
        /* Maximum "level" for various things */
        if (lev > MAX_DEPTH - 1) lev = MAX_DEPTH - 1;
@@ -4205,7 +4205,7 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
                case TV_RING:
                case TV_AMULET:
                {
-                       if (!power && (rand_int(100) < 50)) power = -1;
+                       if (!power && (randint0(100) < 50)) power = -1;
                        a_m_aux_3(o_ptr, lev, power);
                        break;
                }
@@ -4301,7 +4301,7 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
 
                /* Randomize the "xtra" power */
                if (o_ptr->xtra1 && !o_ptr->art_name)
-                       o_ptr->xtra2 = randint(256);
+                       o_ptr->xtra2 = randint1(256);
 
                /* Hack -- acquire "broken" flag */
                if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
@@ -4313,12 +4313,12 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
                if (cursed_p(o_ptr) || broken_p(o_ptr))
                {
                        /* Hack -- obtain bonuses */
-                       if (e_ptr->max_to_h) o_ptr->to_h -= randint(e_ptr->max_to_h);
-                       if (e_ptr->max_to_d) o_ptr->to_d -= randint(e_ptr->max_to_d);
-                       if (e_ptr->max_to_a) o_ptr->to_a -= randint(e_ptr->max_to_a);
+                       if (e_ptr->max_to_h) o_ptr->to_h -= randint1(e_ptr->max_to_h);
+                       if (e_ptr->max_to_d) o_ptr->to_d -= randint1(e_ptr->max_to_d);
+                       if (e_ptr->max_to_a) o_ptr->to_a -= randint1(e_ptr->max_to_a);
 
                        /* Hack -- obtain pval */
-                       if (e_ptr->max_pval) o_ptr->pval -= randint(e_ptr->max_pval);
+                       if (e_ptr->max_pval) o_ptr->pval -= randint1(e_ptr->max_pval);
                }
 
                /* Hack -- apply extra bonuses if needed */
@@ -4328,20 +4328,20 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
                        if (e_ptr->max_to_h)
                        {
                                if (e_ptr->max_to_h > 127)
-                                       o_ptr->to_h -= randint(256-e_ptr->max_to_h);
-                               else o_ptr->to_h += randint(e_ptr->max_to_h);
+                                       o_ptr->to_h -= randint1(256-e_ptr->max_to_h);
+                               else o_ptr->to_h += randint1(e_ptr->max_to_h);
                        }
                        if (e_ptr->max_to_d)
                        {
                                if (e_ptr->max_to_d > 127)
-                                       o_ptr->to_d -= randint(256-e_ptr->max_to_d);
-                               else o_ptr->to_d += randint(e_ptr->max_to_d);
+                                       o_ptr->to_d -= randint1(256-e_ptr->max_to_d);
+                               else o_ptr->to_d += randint1(e_ptr->max_to_d);
                        }
                        if (e_ptr->max_to_a)
                        {
                                if (e_ptr->max_to_a > 127)
-                                       o_ptr->to_a -= randint(256-e_ptr->max_to_a);
-                               else o_ptr->to_a += randint(e_ptr->max_to_a);
+                                       o_ptr->to_a -= randint1(256-e_ptr->max_to_a);
+                               else o_ptr->to_a += randint1(e_ptr->max_to_a);
                        }
 
                        /* Hack -- obtain pval */
@@ -4354,24 +4354,24 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
                                }
                                else if (o_ptr->name2 == EGO_ATTACKS)
                                {
-                                       o_ptr->pval = randint(e_ptr->max_pval*lev/100+1);
+                                       o_ptr->pval = randint1(e_ptr->max_pval*lev/100+1);
                                        if (o_ptr->pval > 3) o_ptr->pval = 3;
                                        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
-                                               o_ptr->pval += randint(2);
+                                               o_ptr->pval += randint1(2);
                                }
                                else if (o_ptr->name2 == EGO_BAT)
                                {
-                                       o_ptr->pval = randint(e_ptr->max_pval);
-                                       if (o_ptr->sval == SV_ELVEN_CLOAK) o_ptr->pval += randint(2);
+                                       o_ptr->pval = randint1(e_ptr->max_pval);
+                                       if (o_ptr->sval == SV_ELVEN_CLOAK) o_ptr->pval += randint1(2);
                                }
                                else
                                {
-                                       o_ptr->pval += randint(e_ptr->max_pval);
+                                       o_ptr->pval += randint1(e_ptr->max_pval);
                                }
                        }
                        if ((o_ptr->name2 == EGO_SPEED) && (lev < 50))
                        {
-                               o_ptr->pval = randint(o_ptr->pval);
+                               o_ptr->pval = randint1(o_ptr->pval);
                        }
                        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS))
                                o_ptr->pval = 2;
@@ -4668,12 +4668,12 @@ bool make_gold(object_type *j_ptr)
 
 
        /* Hack -- Pick a Treasure variety */
-       i = ((randint(object_level + 2) + 2) / 2) - 1;
+       i = ((randint1(object_level + 2) + 2) / 2) - 1;
 
        /* Apply "extra" magic */
        if (one_in_(GREAT_OBJ))
        {
-               i += randint(object_level + 1);
+               i += randint1(object_level + 1);
        }
 
        /* Hack -- Creeping Coins only generate "themselves" */
@@ -4689,7 +4689,7 @@ bool make_gold(object_type *j_ptr)
        base = k_info[OBJ_GOLD_LIST+i].cost;
 
        /* Determine how much the treasure is "worth" */
-       j_ptr->pval = (base + (8L * randint(base)) + randint(8));
+       j_ptr->pval = (base + (8L * randint1(base)) + randint1(8));
 
        /* Success */
        return (TRUE);
@@ -4811,7 +4811,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 
 
        /* Handle normal "breakage" */
-       if (!(j_ptr->art_name || artifact_p(j_ptr)) && (rand_int(100) < chance))
+       if (!(j_ptr->art_name || artifact_p(j_ptr)) && (randint0(100) < chance))
        {
                /* Message */
 #ifdef JP
@@ -4974,8 +4974,8 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
                /* Random locations */
                else
                {
-                       ty = rand_int(cur_hgt);
-                       tx = rand_int(cur_wid);
+                       ty = randint0(cur_hgt);
+                       tx = randint0(cur_wid);
                }
 
                /* Grid */
@@ -5193,7 +5193,7 @@ void pick_trap(int y, int x)
        while (1)
        {
                /* Hack -- pick a trap */
-               feat = trap_num[rand_int(MAX_TRAPS)];
+               feat = trap_num[randint0(MAX_TRAPS)];
 
                /* Accept non-trapdoors */
                if (feat != FEAT_TRAP_TRAPDOOR) break;
@@ -6198,7 +6198,7 @@ object_type *choose_warning_item(void)
        }
 
        /* Choice one of them */
-       return (&inventory[choices[rand_int(number)]]);
+       return (&inventory[choices[randint0(number)]]);
 }
 
 /* Examine the grid (xx,yy) and warn the player if there are any danger */
@@ -7512,8 +7512,8 @@ static void add_essence(int mode)
 #endif
                                return;
                        }
-                       get_to_h = ((val+1)/2+rand_int(val/2+1));
-                       get_to_d = ((val+1)/2+rand_int(val/2+1));
+                       get_to_h = ((val+1)/2+randint0(val/2+1));
+                       get_to_d = ((val+1)/2+randint0(val/2+1));
                        o_ptr->xtra4 = (get_to_h<<8)+get_to_d;
                        o_ptr->to_h += get_to_h;
                        o_ptr->to_d += get_to_d;
index 01a5452..40bbc7c 100644 (file)
@@ -357,7 +357,7 @@ s = "
                        if (p_ptr->magic_num2[o_ptr->sval + ext])
                        {
                                gain_num *= 256;
-                               gain_num = (gain_num/3 + rand_int(gain_num/3)) / 256;
+                               gain_num = (gain_num/3 + randint0(gain_num/3)) / 256;
                                if (gain_num < 1) gain_num = 1;
                        }
                        p_ptr->magic_num2[o_ptr->sval + ext] += gain_num;
@@ -776,17 +776,17 @@ if (!get_check("
                if (use_hp)
                {
 #ifdef JP
-                       take_hit(DAMAGE_USELIFE, (cost / 2) + randint(cost / 2),
+                       take_hit(DAMAGE_USELIFE, (cost / 2) + randint1(cost / 2),
                                 "²áÅ٤ν¸Ãæ", -1);
 #else
-                       take_hit(DAMAGE_USELIFE, (cost / 2) + randint(cost / 2),
+                       take_hit(DAMAGE_USELIFE, (cost / 2) + randint1(cost / 2),
                                 "concentrating too hard", -1);
 #endif
 
                }
                else
                {
-                       p_ptr->csp -= (cost / 2) + randint(cost / 2);
+                       p_ptr->csp -= (cost / 2) + randint1(cost / 2);
                }
        }
 
@@ -798,8 +798,8 @@ if (!get_check("
        p_ptr->window |= (PW_PLAYER | PW_SPELL);
 
        /* Success? */
-       if (randint(p_ptr->stat_cur[use_stat]) >=
-           ((difficulty / 2) + randint(difficulty / 2)))
+       if (randint1(p_ptr->stat_cur[use_stat]) >=
+           ((difficulty / 2) + randint1(difficulty / 2)))
        {
                return TRUE;
        }
@@ -834,7 +834,7 @@ static bool cmd_racial_power_aux(s32b command)
 
                                for (i = 0; i < 6; i++)
                                {
-                                       dir = rand_int(8);
+                                       dir = randint0(8);
                                        y = py + ddy_ddd[dir];
                                        x = px + ddx_ddd[dir];
                                        c_ptr = &cave[y][x];
@@ -899,7 +899,7 @@ msg_print("
                                if (cave[y][x].m_idx)
                                {
                                        py_attack(y, x, 0);
-                                       if (rand_int(p_ptr->skill_dis) < 7)
+                                       if (randint0(p_ptr->skill_dis) < 7)
 #ifdef JP
 msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
 #else
@@ -1316,7 +1316,7 @@ msg_print("
                                rlev = r_ptr->level;
                                if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
                                if (rlev > 60) rlev = 60+(rlev-60)/2;
-                               if ((randint(skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+rand_int(p_ptr->lev/5)))
+                               if ((randint1(skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+randint0(p_ptr->lev/5)))
                                {
 #ifdef JP
                                        msg_format("%s¤ò¼ê¤Ê¤º¤±¤¿¡£",m_name);
@@ -1489,7 +1489,7 @@ msg_print("
                                msg_print("You grin and bare your fangs...");
 #endif
 
-                               dummy = plev + randint(plev) * MAX(1, plev / 10);   /* Dmg */
+                               dummy = plev + randint1(plev) * MAX(1, plev / 10);   /* Dmg */
                                if (drain_life(dir, dummy))
                                {
                                        if (p_ptr->food < PY_FOOD_FULL)
@@ -1605,7 +1605,7 @@ msg_print("
 
                                (void)set_afraid(0);
 
-                               (void)set_shero(10 + randint(plev), FALSE);
+                               (void)set_shero(10 + randint1(plev), FALSE);
                                (void)hp_player(30);
                        }
                        break;
@@ -1680,7 +1680,7 @@ msg_print("
 
                                (void)set_afraid(0);
 
-                               (void)set_shero(10 + randint(plev), FALSE);
+                               (void)set_shero(10 + randint1(plev), FALSE);
                                (void)hp_player(30);
                        }
                        break;
@@ -1825,7 +1825,7 @@ cptr Type_desc = ((Type == GF_COLD) ? "
 #endif
 
 
-                               if (randint(100) < plev)
+                               if (randint1(100) < plev)
                                {
                                        switch (p_ptr->pclass)
                                        {
@@ -2084,7 +2084,7 @@ msg_print("
                case RACE_GOLEM:
                        if (racial_aux(20, 15, A_CON, 8))
                        {
-                               (void)set_shield(randint(20) + 30, FALSE);
+                               (void)set_shield(randint1(20) + 30, FALSE);
                        }
                        break;
 
@@ -2131,7 +2131,7 @@ msg_print("
                                msg_print("You grin and bare your fangs...");
 #endif
 
-                               dummy = plev + randint(plev) * MAX(1, plev / 10);   /* Dmg */
+                               dummy = plev + randint1(plev) * MAX(1, plev / 10);   /* Dmg */
                                if (drain_life(dir, dummy))
                                {
                                        if (p_ptr->food < PY_FOOD_FULL)
@@ -2211,7 +2211,7 @@ msg_format("
                case RACE_KUTA:
                        if (racial_aux(20, 15, A_CHR, 8))
                        {
-                               (void)set_tsubureru(randint(20) + 30, FALSE);
+                               (void)set_tsubureru(randint1(20) + 30, FALSE);
                        }
                        break;
 
index 2e8850b..c640644 100644 (file)
@@ -46,7 +46,7 @@ static void place_locked_door(int y, int x)
        }
        else
        {
-               set_cave_feat(y, x, FEAT_DOOR_HEAD+randint(7));
+               set_cave_feat(y, x, FEAT_DOOR_HEAD+randint1(7));
                cave[y][x].info &= ~(CAVE_FLOOR);
        }
 }
@@ -88,7 +88,7 @@ static void build_small_room(int x0, int y0)
        }
 
        /* Place a secret door on one side */
-       switch (rand_int(4))
+       switch (randint0(4))
        {
                case 0: place_secret_door(y0, x0 - 1); break;
                case 1: place_secret_door(y0, x0 + 1); break;
@@ -300,10 +300,10 @@ static void build_type1(int by0, int bx0)
        cave_type *c_ptr;
 
        /* Pick a room size */
-       y1 = randint(4);
-       x1 = randint(11);
-       y2 = randint(3);
-       x2 = randint(11);
+       y1 = randint1(4);
+       x1 = randint1(11);
+       y2 = randint1(3);
+       x2 = randint1(11);
 
        xsize = x1 + x2 + 1;
        ysize = y1 + y2 + 1;
@@ -312,7 +312,7 @@ static void build_type1(int by0, int bx0)
        if (!room_alloc(xsize + 2, ysize + 2, FALSE, by0, bx0, &xval, &yval)) return;
 
        /* Choose lite or dark */
-       light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
 
 
        /* Get corner values */
@@ -404,7 +404,7 @@ static void build_type1(int by0, int bx0)
        /* Hack -- Occasional divided room */
        else if (one_in_(50))
        {
-               if (randint(100) < 50)
+               if (randint1(100) < 50)
                {
                        /* Horizontal wall */
                        for (x = x1; x <= x2; x++)
@@ -450,19 +450,19 @@ static void build_type2(int by0, int bx0)
        if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
 
        /* Choose lite or dark */
-       light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
 
        /* Determine extents of the first room */
-       y1a = yval - randint(4);
-       y2a = yval + randint(3);
-       x1a = xval - randint(11);
-       x2a = xval + randint(10);
+       y1a = yval - randint1(4);
+       y2a = yval + randint1(3);
+       x1a = xval - randint1(11);
+       x2a = xval + randint1(10);
 
        /* Determine extents of the second room */
-       y1b = yval - randint(3);
-       y2b = yval + randint(4);
-       x1b = xval - randint(10);
-       x2b = xval + randint(11);
+       y1b = yval - randint1(3);
+       y2b = yval + randint1(4);
+       x1b = xval - randint1(10);
+       x2b = xval + randint1(11);
 
 
        /* Place a full floor for room "a" */
@@ -573,7 +573,7 @@ static void build_type3(int by0, int bx0)
        if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
 
        /* Choose lite or dark */
-       light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
 
        /* For now, always 3x3 */
        wx = wy = 1;
@@ -679,7 +679,7 @@ static void build_type3(int by0, int bx0)
 
 
        /* Special features (3/4) */
-       switch (rand_int(4))
+       switch (randint0(4))
        {
                /* Large solid middle pillar */
                case 1:
@@ -715,7 +715,7 @@ static void build_type3(int by0, int bx0)
                        }
 
                        /* Place a secret door on the inner room */
-                       switch (rand_int(4))
+                       switch (randint0(4))
                        {
                                case 0: place_secret_door(y1b, xval); break;
                                case 1: place_secret_door(y2b, xval); break;
@@ -727,10 +727,10 @@ static void build_type3(int by0, int bx0)
                        place_object(yval, xval, FALSE, FALSE);
 
                        /* Let's guard the treasure well */
-                       vault_monsters(yval, xval, rand_int(2) + 3);
+                       vault_monsters(yval, xval, randint0(2) + 3);
 
                        /* Traps naturally */
-                       vault_traps(yval, xval, 4, 4, rand_int(3) + 2);
+                       vault_traps(yval, xval, 4, 4, randint0(3) + 2);
 
                        break;
                }
@@ -821,7 +821,7 @@ static void build_type4(int by0, int bx0)
        if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
 
        /* Choose lite or dark */
-       light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
 
        /* Large room */
        y1 = yval - 4;
@@ -882,13 +882,13 @@ static void build_type4(int by0, int bx0)
 
 
        /* Inner room variations */
-       switch (randint(5))
+       switch (randint1(5))
        {
                /* Just an inner room with a monster */
                case 1:
                {
                        /* Place a secret door */
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1: place_secret_door(y1 - 1, xval); break;
                                case 2: place_secret_door(y2 + 1, xval); break;
@@ -906,7 +906,7 @@ static void build_type4(int by0, int bx0)
                case 2:
                {
                        /* Place a secret door */
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1: place_secret_door(y1 - 1, xval); break;
                                case 2: place_secret_door(y2 + 1, xval); break;
@@ -926,7 +926,7 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Place a locked door on the inner room */
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1: place_locked_door(yval - 1, xval); break;
                                case 2: place_locked_door(yval + 1, xval); break;
@@ -935,10 +935,10 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Monsters to guard the "treasure" */
-                       vault_monsters(yval, xval, randint(3) + 2);
+                       vault_monsters(yval, xval, randint1(3) + 2);
 
                        /* Object (80%) */
-                       if (rand_int(100) < 80)
+                       if (randint0(100) < 80)
                        {
                                place_object(yval, xval, FALSE, FALSE);
                        }
@@ -950,7 +950,7 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Traps to protect the treasure */
-                       vault_traps(yval, xval, 4, 10, 2 + randint(3));
+                       vault_traps(yval, xval, 4, 10, 2 + randint1(3));
 
                        break;
                }
@@ -959,7 +959,7 @@ static void build_type4(int by0, int bx0)
                case 3:
                {
                        /* Place a secret door */
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1: place_secret_door(y1 - 1, xval); break;
                                case 2: place_secret_door(y2 + 1, xval); break;
@@ -980,7 +980,7 @@ static void build_type4(int by0, int bx0)
                        /* Occasionally, two more Large Inner Pillars */
                        if (one_in_(2))
                        {
-                               tmp = randint(2);
+                               tmp = randint1(2);
                                for (y = yval - 1; y <= yval + 1; y++)
                                {
                                        for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++)
@@ -1015,12 +1015,12 @@ static void build_type4(int by0, int bx0)
                                place_inner_grid(c_ptr);
 
                                /* Secret doors (random top/bottom) */
-                               place_secret_door(yval - 3 + (randint(2) * 2), xval - 3);
-                               place_secret_door(yval - 3 + (randint(2) * 2), xval + 3);
+                               place_secret_door(yval - 3 + (randint1(2) * 2), xval - 3);
+                               place_secret_door(yval - 3 + (randint1(2) * 2), xval + 3);
 
                                /* Monsters */
-                               vault_monsters(yval, xval - 2, randint(2));
-                               vault_monsters(yval, xval + 2, randint(2));
+                               vault_monsters(yval, xval - 2, randint1(2));
+                               vault_monsters(yval, xval + 2, randint1(2));
 
                                /* Objects */
                                if (one_in_(3)) place_object(yval, xval - 2, FALSE, FALSE);
@@ -1034,7 +1034,7 @@ static void build_type4(int by0, int bx0)
                case 4:
                {
                        /* Place a secret door */
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1: place_secret_door(y1 - 1, xval); break;
                                case 2: place_secret_door(y2 + 1, xval); break;
@@ -1056,12 +1056,12 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Monsters just love mazes. */
-                       vault_monsters(yval, xval - 5, randint(3));
-                       vault_monsters(yval, xval + 5, randint(3));
+                       vault_monsters(yval, xval - 5, randint1(3));
+                       vault_monsters(yval, xval + 5, randint1(3));
 
                        /* Traps make them entertaining. */
-                       vault_traps(yval, xval - 3, 2, 8, randint(3));
-                       vault_traps(yval, xval + 3, 2, 8, randint(3));
+                       vault_traps(yval, xval - 3, 2, 8, randint1(3));
+                       vault_traps(yval, xval + 3, 2, 8, randint1(3));
 
                        /* Mazes should have some treasure too. */
                        vault_objects(yval, xval, 3);
@@ -1085,9 +1085,9 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Doors into the rooms */
-                       if (rand_int(100) < 50)
+                       if (randint0(100) < 50)
                        {
-                               int i = randint(10);
+                               int i = randint1(10);
                                place_secret_door(y1 - 1, xval - i);
                                place_secret_door(y1 - 1, xval + i);
                                place_secret_door(y2 + 1, xval - i);
@@ -1095,7 +1095,7 @@ static void build_type4(int by0, int bx0)
                        }
                        else
                        {
-                               int i = randint(3);
+                               int i = randint1(3);
                                place_secret_door(yval + i, x1 - 1);
                                place_secret_door(yval - i, x1 - 1);
                                place_secret_door(yval + i, x2 + 1);
@@ -1103,13 +1103,13 @@ static void build_type4(int by0, int bx0)
                        }
 
                        /* Treasure, centered at the center of the cross */
-                       vault_objects(yval, xval, 2 + randint(2));
+                       vault_objects(yval, xval, 2 + randint1(2));
 
                        /* Gotta have some monsters. */
-                       vault_monsters(yval + 1, xval - 4, randint(4));
-                       vault_monsters(yval + 1, xval + 4, randint(4));
-                       vault_monsters(yval - 1, xval - 4, randint(4));
-                       vault_monsters(yval - 1, xval + 4, randint(4));
+                       vault_monsters(yval + 1, xval - 4, randint1(4));
+                       vault_monsters(yval + 1, xval + 4, randint1(4));
+                       vault_monsters(yval - 1, xval - 4, randint1(4));
+                       vault_monsters(yval - 1, xval + 4, randint1(4));
 
                        break;
                }
@@ -1515,7 +1515,7 @@ static void vault_prep_symbol(void)
 static void vault_prep_dragon(void)
 {
        /* Pick dragon type */
-       switch (rand_int(6))
+       switch (randint0(6))
        {
                /* Black */
                case 0:
@@ -1627,7 +1627,7 @@ static vault_aux_type *pick_vault_type(vault_aux_type *l_ptr, int room)
        }
 
        /* Pick a random type */
-       tmp = rand_int(total);
+       tmp = randint0(total);
 
        /* Find this type */
        for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)
@@ -1800,7 +1800,7 @@ void build_type5(int by0, int bx0, bool pit)
 
 
        /* Place a secret door */
-       switch (randint(4))
+       switch (randint1(4))
        {
                case 1: place_secret_door(y1 - 1, xval); break;
                case 2: place_secret_door(y2 + 1, xval); break;
@@ -1860,7 +1860,7 @@ msg_format("
        rating += 10;
 
        /* (Sometimes) Cause a "special feeling" (for "Monster Nests") */
-       if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+       if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
        {
                good_item_flag = TRUE;
        }
@@ -1870,7 +1870,7 @@ msg_format("
        {
                for (x = xval - 9; x <= xval + 9; x++)
                {
-                       int r_idx = what[rand_int(64)];
+                       int r_idx = what[randint0(64)];
 
                        /* Place that "random" monster (no groups) */
                        (void)place_monster_aux(y, x, r_idx, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
@@ -2032,7 +2032,7 @@ void build_type6(int by0, int bx0, bool nest)
        }
 
        /* Place a secret door */
-       switch (randint(4))
+       switch (randint1(4))
        {
                case 1: place_secret_door(y1 - 1, xval); break;
                case 2: place_secret_door(y2 + 1, xval); break;
@@ -2125,7 +2125,7 @@ msg_format("%s
        rating += 10;
 
        /* (Sometimes) Cause a "special feeling" (for "Monster Pits") */
-       if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+       if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
        {
                good_item_flag = TRUE;
        }
@@ -2289,7 +2289,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
 
                                /* Treasure/trap */
                        case '*':
-                               if (rand_int(100) < 75)
+                               if (randint0(100) < 75)
                                {
                                        place_object(y, x, FALSE, FALSE);
                                }
@@ -2390,13 +2390,13 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                                /* Monster and/or object */
                                case ',':
                                {
-                                       if (rand_int(100) < 50)
+                                       if (randint0(100) < 50)
                                        {
                                                monster_level = base_level + 3;
                                                place_monster(y, x, TRUE, TRUE);
                                                monster_level = base_level;
                                        }
-                                       if (rand_int(100) < 50)
+                                       if (randint0(100) < 50)
                                        {
                                                object_level = base_level + 7;
                                                place_object(y, x, FALSE, FALSE);
@@ -2469,7 +2469,7 @@ static void build_type7(int by0, int bx0)
                dummy++;
 
                /* Access a random vault record */
-               v_ptr = &v_info[rand_int(max_v_idx)];
+               v_ptr = &v_info[randint0(max_v_idx)];
 
                /* Accept the first lesser vault */
                if (v_ptr->typ == 7) break;
@@ -2479,7 +2479,7 @@ static void build_type7(int by0, int bx0)
        if (!v_ptr) return;
 
        /* pick type of transformation (0-7) */
-       transno = rand_int(8);
+       transno = randint0(8);
 
        /* calculate offsets */
        x = v_ptr->wid;
@@ -2535,7 +2535,7 @@ msg_print("
 
        /* (Sometimes) Cause a special feeling */
        if ((dun_level <= 50) ||
-               (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+               (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
        {
                good_item_flag = TRUE;
        }
@@ -2564,7 +2564,7 @@ static void build_type8(int by0, int bx0)
                dummy++;
 
                /* Access a random vault record */
-               v_ptr = &v_info[rand_int(max_v_idx)];
+               v_ptr = &v_info[randint0(max_v_idx)];
 
                /* Accept the first greater vault */
                if (v_ptr->typ == 8) break;
@@ -2574,7 +2574,7 @@ static void build_type8(int by0, int bx0)
        if (!v_ptr) return;
 
        /* pick type of transformation (0-7) */
-       transno = rand_int(8);
+       transno = randint0(8);
 
        /* calculate offsets */
        x = v_ptr->wid;
@@ -2619,7 +2619,7 @@ msg_print("
 
 
 #ifdef FORCE_V_IDX
-       v_ptr = &v_info[76 + randint(3)];
+       v_ptr = &v_info[76 + randint1(3)];
 #endif
 
        /* Message */
@@ -2630,7 +2630,7 @@ msg_print("
 
        /* (Sometimes) Cause a special feeling */
        if ((dun_level <= 50) ||
-           (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+           (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
        {
                good_item_flag = TRUE;
        }
@@ -2858,7 +2858,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
-                                               store_height(ii, jj, randint(maxsize));
+                                               store_height(ii, jj, randint1(maxsize));
                                        }
                                        else
                                        {
@@ -2866,7 +2866,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                                store_height(ii, jj,
                                                        (cave[jj][fill_data.xmin + (i - xhstep) / 256].feat
                                                         + cave[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2
-                                                        + (randint(xstep2) - xhstep2) * roug / 16);
+                                                        + (randint1(xstep2) - xhstep2) * roug / 16);
                                        }
                                }
                        }
@@ -2888,7 +2888,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
-                                               store_height(ii, jj, randint(maxsize));
+                                               store_height(ii, jj, randint1(maxsize));
                                        }
                                        else
                                        {
@@ -2896,7 +2896,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                                store_height(ii, jj,
                                                        (cave[fill_data.ymin + (j - yhstep) / 256][ii].feat
                                                        + cave[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2
-                                                       + (randint(ystep2) - yhstep2) * roug / 16);
+                                                       + (randint1(ystep2) - yhstep2) * roug / 16);
                                        }
                                }
                        }
@@ -2917,7 +2917,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
-                                               store_height(ii, jj, randint(maxsize));
+                                               store_height(ii, jj, randint1(maxsize));
                                        }
                                        else
                                        {
@@ -2934,7 +2934,7 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                                store_height(ii, jj,
                                                        (cave[ym][xm].feat + cave[yp][xm].feat
                                                        + cave[ym][xp].feat + cave[yp][xp].feat) / 4
-                                                       + (randint(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
+                                                       + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
                                        }
                                }
                        }
@@ -2963,7 +2963,7 @@ static bool hack_isnt_wall(int y, int x, int c1, int c2, int c3, int feat1, int
                if (cave[y][x].feat <= c1)
                {
                        /* 25% of the time use the other tile : it looks better this way */
-                       if (randint(100) < 75)
+                       if (randint1(100) < 75)
                        {
                                cave[y][x].feat = feat1;
                                cave[y][x].info &= ~(CAVE_MASK);
@@ -2981,7 +2981,7 @@ static bool hack_isnt_wall(int y, int x, int c1, int c2, int c3, int feat1, int
                else if (cave[y][x].feat <= c2)
                {
                        /* 25% of the time use the other tile : it looks better this way */
-                       if (randint(100) < 75)
+                       if (randint1(100) < 75)
                        {
                                cave[y][x].feat = feat2;
                                cave[y][x].info &= ~(CAVE_MASK);
@@ -3122,9 +3122,9 @@ static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, b
        fill_data.c3 = 0;
 
        /* features to fill with */
-       fill_data.feat1 = floor_type[rand_int(100)];
-       fill_data.feat2 = floor_type[rand_int(100)];
-       fill_data.feat3 = floor_type[rand_int(100)];
+       fill_data.feat1 = floor_type[randint0(100)];
+       fill_data.feat2 = floor_type[randint0(100)];
+       fill_data.feat3 = floor_type[randint0(100)];
 
        fill_data.info1 = CAVE_FLOOR;
        fill_data.info2 = CAVE_FLOOR;
@@ -3295,8 +3295,8 @@ static void build_type9(int by0, int bx0)
        bool done, light, room;
 
        /* get size: note 'Evenness'*/
-       xsize = randint(22) * 2 + 6;
-       ysize = randint(15) * 2 + 6;
+       xsize = randint1(22) * 2 + 6;
+       ysize = randint1(15) * 2 + 6;
 
        /* Try to allocate space for room.  If fails, exit */
        if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
@@ -3304,7 +3304,7 @@ static void build_type9(int by0, int bx0)
        light = done = FALSE;
        room = TRUE;
 
-       if ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+       if ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
 
        while (!done)
        {
@@ -3312,14 +3312,14 @@ static void build_type9(int by0, int bx0)
                * This causes the tunnels not to connect properly to the room */
 
                /* testing values for these parameters feel free to adjust */
-               grd = 1 << (rand_int(4));
+               grd = 1 << (randint0(4));
 
                /* want average of about 16 */
-               roug = randint(8) * randint(4);
+               roug = randint1(8) * randint1(4);
 
                /* about size/2 */
-               cutoff = randint(xsize / 4) + randint(ysize / 4) +
-                        randint(xsize / 4) + randint(ysize / 4);
+               cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+                        randint1(xsize / 4) + randint1(ysize / 4);
 
                /* make it */
                generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
@@ -3339,7 +3339,7 @@ void build_cavern(void)
        bool done, light;
 
        light = done = FALSE;
-       if ((dun_level <= randint(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+       if ((dun_level <= randint1(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
 
        /* Make a cave the size of the dungeon */
        xsize = cur_wid - 1;
@@ -3354,10 +3354,10 @@ void build_cavern(void)
        while (!done)
        {
                /* testing values for these parameters: feel free to adjust */
-               grd = randint(4) + 4;
+               grd = randint1(4) + 4;
 
                /* want average of about 16 */
-               roug = randint(8) * randint(4);
+               roug = randint1(8) * randint1(4);
 
                /* about size/2 */
                cutoff = xsize / 2;
@@ -3386,24 +3386,24 @@ static bool generate_lake(int y0, int x0, int xsize, int ysize, int c1, int c2,
                                /* Lava */
                                feat1 = FEAT_DEEP_LAVA;
                                feat2 = FEAT_SHAL_LAVA;
-                               feat3 = floor_type[rand_int(100)];
+                               feat3 = floor_type[randint0(100)];
                                }; break;
                case 2:{
                                /* Water */
                                feat1 = FEAT_DEEP_WATER;
                                feat2 = FEAT_SHAL_WATER;
-                               feat3 = floor_type[rand_int(100)];
+                               feat3 = floor_type[randint0(100)];
                                }; break;
                case 3: {
                                /* Collapsed cave */
-                               feat1 = floor_type[rand_int(100)];
-                               feat2 = floor_type[rand_int(100)];
+                               feat1 = floor_type[randint0(100)];
+                               feat2 = floor_type[randint0(100)];
                                feat3 = FEAT_RUBBLE;
                                }; break;
                case 4: {
                                /* Earth vault */
                                feat1 = FEAT_RUBBLE;
-                               feat2 = floor_type[rand_int(100)];
+                               feat2 = floor_type[randint0(100)];
                                feat3 = FEAT_RUBBLE;
                                }; break;
                case 5: {
@@ -3551,17 +3551,17 @@ void build_lake(int type)
        while (!done)
        {
                /* testing values for these parameters: feel free to adjust */
-               grd = randint(3) + 4;
+               grd = randint1(3) + 4;
 
                /* want average of about 16 */
-               roug = randint(8) * randint(4);
+               roug = randint1(8) * randint1(4);
 
                /* Make up size of various componants */
                /* Floor */
                c3 = 3 * xsize / 4;
 
                /* Deep water/lava */
-               c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+               c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
 
                /* Shallow boundary */
                c2 = (c1 + c3) / 2;
@@ -3650,10 +3650,10 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                {
                        /* Thing added based on distance to center of vault
                         * Difficulty is 1-easy to 10-hard */
-                       value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint(10) - difficulty;
+                       value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint1(10) - difficulty;
 
                        /* hack- empty square part of the time */
-                       if ((randint(100) - difficulty * 3) > 50) value = 20;
+                       if ((randint1(100) - difficulty * 3) > 50) value = 20;
 
                         /* if floor, shallow water and lava */
                        if (is_floor_bold(y, x) ||
@@ -3702,7 +3702,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                else if (value < 23)
                                {
                                        /* Object or trap */
-                                       if (rand_int(100) < 25)
+                                       if (randint0(100) < 25)
                                        {
                                                place_object(y, x, FALSE, FALSE);
                                        }
@@ -3722,13 +3722,13 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                else if (value < 40)
                                {
                                        /* Monster or object */
-                                       if (rand_int(100) < 50)
+                                       if (randint0(100) < 50)
                                        {
                                                monster_level = base_level + 3;
                                                place_monster(y, x, TRUE, TRUE);
                                                monster_level = base_level;
                                        }
-                                       if (rand_int(100) < 50)
+                                       if (randint0(100) < 50)
                                        {
                                                object_level = base_level + 7;
                                                place_object(y, x, FALSE, FALSE);
@@ -3745,15 +3745,15 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        /* Various Stuff */
 
                                        /* 20% monster, 40% trap, 20% object, 20% blank space */
-                                       if (rand_int(100) < 20)
+                                       if (randint0(100) < 20)
                                        {
                                                place_monster(y, x, TRUE, TRUE);
                                        }
-                                       else if (rand_int(100) < 50)
+                                       else if (randint0(100) < 50)
                                        {
                                                place_trap(y, x);
                                        }
-                                       else if (rand_int(100) < 50)
+                                       else if (randint0(100) < 50)
                                        {
                                                place_object(y, x, FALSE, FALSE);
                                        }
@@ -3795,8 +3795,8 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
        if (cheat_room) msg_print("Bubble Vault");
 
        /* Allocate center of bubbles */
-       center[0].x = randint(xsize - 3) + 1;
-       center[0].y = randint(ysize - 3) + 1;
+       center[0].x = randint1(xsize - 3) + 1;
+       center[0].y = randint1(ysize - 3) + 1;
 
        for (i = 1; i < BUBBLENUM; i++)
        {
@@ -3807,8 +3807,8 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
                {
                        done = TRUE;
 
-                       x = randint(xsize - 3) + 1;
-                       y = randint(ysize - 3) + 1;
+                       x = randint1(xsize - 3) + 1;
+                       y = randint1(ysize - 3) + 1;
 
                        for (j = 0; j < i; j++)
                        {
@@ -3899,13 +3899,13 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
        /* Try to add some random doors */
        for (i = 0; i < 500; i++)
        {
-               x = randint(xsize - 3) - xhsize + x0 + 1;
-               y = randint(ysize - 3) - yhsize + y0 + 1;
+               x = randint1(xsize - 3) - xhsize + x0 + 1;
+               y = randint1(ysize - 3) - yhsize + y0 + 1;
                add_door(x, y);
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5));
+       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
 }
 
 
@@ -4012,23 +4012,23 @@ static void build_room_vault(int x0, int y0, int xsize, int ysize)
        /* add ten random rooms */
        for (i = 0; i < 10; i++)
        {
-               x1 = randint(xhsize) * 2 + x0 - xhsize;
-               x2 = randint(xhsize) * 2 + x0 - xhsize;
-               y1 = randint(yhsize) * 2 + y0 - yhsize;
-               y2 = randint(yhsize) * 2 + y0 - yhsize;
+               x1 = randint1(xhsize) * 2 + x0 - xhsize;
+               x2 = randint1(xhsize) * 2 + x0 - xhsize;
+               y1 = randint1(yhsize) * 2 + y0 - yhsize;
+               y2 = randint1(yhsize) * 2 + y0 - yhsize;
                build_room(x1, x2, y1, y2);
        }
 
        /* Add some random doors */
        for (i = 0; i < 500; i++)
        {
-               x1 = randint(xsize - 3) - xhsize + x0 + 1;
-               y1 = randint(ysize - 3) - yhsize + y0 + 1;
+               x1 = randint1(xsize - 3) - xhsize + x0 + 1;
+               y1 = randint1(ysize - 3) - yhsize + y0 + 1;
                add_door(x1, y1);
        }
 
        /* Fill with monsters and treasure, high difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5) + 5);
+       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
 }
 
 
@@ -4052,14 +4052,14 @@ static void build_cave_vault(int x0, int y0, int xsiz, int ysiz)
        while (!done)
        {
                /* testing values for these parameters feel free to adjust */
-               grd = 1 << rand_int(4);
+               grd = 1 << randint0(4);
 
                /* want average of about 16 */
-               roug = randint(8) * randint(4);
+               roug = randint1(8) * randint1(4);
 
                /* about size/2 */
-               cutoff = randint(xsize / 4) + randint(ysize / 4) +
-                        randint(xsize / 4) + randint(ysize / 4);
+               cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+                        randint1(xsize / 4) + randint1(ysize / 4);
 
                /* make it */
                generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
@@ -4078,7 +4078,7 @@ static void build_cave_vault(int x0, int y0, int xsiz, int ysiz)
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 
 /*
@@ -4096,7 +4096,7 @@ static void build_cave_vault(int x0, int y0, int xsiz, int ysiz)
  *
  * The spanning tree is created by performing a suitably randomized
  * depth-first traversal of the graph. The only adjustable parameter
- * is the rand_int(3) below; it governs the relative density of
+ * is the randint0(3) below; it governs the relative density of
  * twists and turns in the labyrinth: smaller number, more twists.
  */
 static void r_visit(int y1, int x1, int y2, int x2,
@@ -4122,7 +4122,7 @@ static void r_visit(int y1, int x1, int y2, int x2,
                        adj[i] = i;
                for (i = 0; i < 4; i++)
                {
-                       j = rand_int(4);
+                       j = randint0(4);
                        temp = adj[i];
                        adj[i] = adj[j];
                        adj[j] = temp;
@@ -4137,7 +4137,7 @@ static void r_visit(int y1, int x1, int y2, int x2,
                        adj[i] = i;
                for (i = 1; i < 4; i++)
                {
-                       j = 1 + rand_int(3);
+                       j = 1 + randint0(3);
                        temp = adj[i];
                        adj[i] = adj[j];
                        adj[j] = temp;
@@ -4196,7 +4196,7 @@ void build_maze_vault(int x0, int y0, int xsize, int ysize, bool is_vault)
        if (cheat_room && is_vault) msg_print("Maze Vault");
 
        /* Choose lite or dark */
-       light = ((dun_level <= randint(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+       light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
 
        /* Pick a random room size - randomized by calling routine */
        dy = ysize / 2 - 1;
@@ -4243,10 +4243,10 @@ void build_maze_vault(int x0, int y0, int xsize, int ysize, bool is_vault)
                visited[i] = 0;
 
        /* traverse the graph to create a spaning tree, pick a random root */
-       r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+       r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
 
        /* Fill with monsters and treasure, low difficulty */
-       if (is_vault) fill_treasure(x1, x2, y1, y2, randint(5));
+       if (is_vault) fill_treasure(x1, x2, y1, y2, randint1(5));
 
        free(visited);
 }
@@ -4339,7 +4339,7 @@ static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
                visited[i] = 0;
 
        /* traverse the graph to create a spannng tree, pick a random root */
-       r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+       r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
 
        /* Make it look like a checker board vault */
        for (x = x1; x <= x2; x++)
@@ -4359,14 +4359,14 @@ static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
        if (one_in_(2))
        {
                /* left and right */
-               y = randint(dy) + dy / 2;
+               y = randint1(dy) + dy / 2;
                place_outer_noperm_bold(y1 + y, x1 - 1);
                place_outer_noperm_bold(y1 + y, x2 + 1);
        }
        else
        {
                /* top and bottom */
-               x = randint(dx) + dx / 2;
+               x = randint1(dx) + dx / 2;
                place_outer_noperm_bold(y1 - 1, x1 + x);
                place_outer_noperm_bold(y2 + 1, x1 + x);
        }
@@ -4408,19 +4408,19 @@ static void build_recursive_room(int x1, int y1, int x2, int y2, int power)
                if (power < 10)
                {
                        /* Make rooms + subdivide */
-                       if ((randint(10) > 2) && (xsize < 8) && (ysize < 8))
+                       if ((randint1(10) > 2) && (xsize < 8) && (ysize < 8))
                        {
                                choice = 4;
                        }
                        else
                        {
-                               choice = randint(2) + 1;
+                               choice = randint1(2) + 1;
                        }
                }
                else
                {
                        /* Mostly subdivide */
-                       choice = randint(3) + 1;
+                       choice = randint1(3) + 1;
                }
        }
 
@@ -4450,23 +4450,23 @@ static void build_recursive_room(int x1, int y1, int x2, int y2, int power)
                        if (one_in_(2))
                        {
                                /* left and right */
-                               y = randint(ysize) + y1;
+                               y = randint1(ysize) + y1;
                                place_floor_bold(y, x1);
                                place_floor_bold(y, x2);
                        }
                        else
                        {
                                /* top and bottom */
-                               x = randint(xsize) + x1;
+                               x = randint1(xsize) + x1;
                                place_floor_bold(y1, x);
                                place_floor_bold(y2, x);
                        }
 
                        /* Select size of keep */
-                       t1 = randint(ysize / 3) + y1;
-                       t2 = y2 - randint(ysize / 3);
-                       t3 = randint(xsize / 3) + x1;
-                       t4 = x2 - randint(xsize / 3);
+                       t1 = randint1(ysize / 3) + y1;
+                       t2 = y2 - randint1(ysize / 3);
+                       t3 = randint1(xsize / 3) + x1;
+                       t4 = x2 - randint1(xsize / 3);
 
                        /* Do outside areas */
 
@@ -4522,7 +4522,7 @@ static void build_recursive_room(int x1, int y1, int x2, int y2, int power)
                        }
 
                        /* Make a door */
-                       y = randint(ysize - 3) + y1 + 1;
+                       y = randint1(ysize - 3) + y1 + 1;
 
                        if (one_in_(2))
                        {
@@ -4555,7 +4555,7 @@ static void build_recursive_room(int x1, int y1, int x2, int y2, int power)
                                return;
                        }
 
-                       t1 = randint(xsize - 2) + x1 + 1;
+                       t1 = randint1(xsize - 2) + x1 + 1;
                        build_recursive_room(x1, y1, t1, y2, power - 2);
                        build_recursive_room(t1 + 1, y1, x2, y2, power - 2);
                        break;
@@ -4576,7 +4576,7 @@ static void build_recursive_room(int x1, int y1, int x2, int y2, int power)
                                return;
                        }
 
-                       t1 = randint(ysize - 2) + y1 + 1;
+                       t1 = randint1(ysize - 2) + y1 + 1;
                        build_recursive_room(x1, y1, x2, t1, power - 2);
                        build_recursive_room(x1, t1 + 1, x2, y2, power - 2);
                        break;
@@ -4621,10 +4621,10 @@ static void build_castle_vault(int x0, int y0, int xsize, int ysize)
        }
 
        /* Make the castle */
-       build_recursive_room(x1, y1, x2, y2, randint(5));
+       build_recursive_room(x1, y1, x2, y2, randint1(5));
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x1, x2, y1, y2, randint(3));
+       fill_treasure(x1, x2, y1, y2, randint1(3));
 }
 
 
@@ -4714,10 +4714,10 @@ static void build_target_vault(int x0, int y0, int xsize, int ysize)
 
        /* Make a random metric */
        int h1, h2, h3, h4;
-       h1 = randint(32) - 16;
-       h2 = randint(16);
-       h3 = randint(32);
-       h4 = randint(32) - 16;
+       h1 = randint1(32) - 16;
+       h2 = randint1(16);
+       h3 = randint1(32);
+       h4 = randint1(32) - 16;
 
        if (cheat_room) msg_print("Target Vault");
 
@@ -4820,7 +4820,7 @@ static void build_target_vault(int x0, int y0, int xsize, int ysize)
        add_door(x0, y0 - y);
 
        /* Fill with stuff - medium difficulty */
-       fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint(3) + 3);
+       fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
 }
 
 
@@ -4873,17 +4873,17 @@ static void build_elemental_vault(int x0, int y0, int xsiz, int ysiz)
        while (!done)
        {
                /* testing values for these parameters: feel free to adjust */
-               grd = 1 << (rand_int(3));
+               grd = 1 << (randint0(3));
 
                /* want average of about 16 */
-               roug = randint(8) * randint(4);
+               roug = randint1(8) * randint1(4);
 
                /* Make up size of various componants */
                /* Floor */
                c3 = 2 * xsize / 3;
 
                /* Deep water/lava */
-               c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+               c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
 
                /* Shallow boundary */
                c2 = (c1 + c3) / 2;
@@ -4907,13 +4907,13 @@ static void build_elemental_vault(int x0, int y0, int xsiz, int ysiz)
        /* make a few rooms in the vault */
        for (i = 1; i <= (xsize * ysize) / 50; i++)
        {
-               build_small_room(x0 + rand_int(xsize - 4) - xsize / 2 + 2,
-                                y0 + rand_int(ysize - 4) - ysize / 2 + 2);
+               build_small_room(x0 + randint0(xsize - 4) - xsize / 2 + 2,
+                                y0 + randint0(ysize - 4) - ysize / 2 + 2);
        }
 
        /* Fill with monsters and treasure, low difficulty */
        fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1,
-                     y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+                     y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 #endif /* ALLOW_CAVERNS_AND_LAKES */
 
@@ -4927,8 +4927,8 @@ static void build_type10(int by0, int bx0)
 
        /* Get size */
        /* big enough to look good, small enough to be fairly common. */
-       xsize = randint(22) + 22;
-       ysize = randint(11) + 11;
+       xsize = randint1(22) + 22;
+       ysize = randint1(11) + 11;
 
        /* Allocate in room_map.  If will not fit, exit */
        if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
@@ -4938,16 +4938,16 @@ static void build_type10(int by0, int bx0)
 
        /* (Sometimes) Cause a special feeling */
        if ((dun_level <= 50) ||
-           (randint((dun_level - 40) * (dun_level - 40) + 1) < 400))
+           (randint1((dun_level - 40) * (dun_level - 40) + 1) < 400))
        {
                good_item_flag = TRUE;
        }
 
        /* Select type of vault */
 #ifdef ALLOW_CAVERNS_AND_LAKES
-       vtype = randint(15);
+       vtype = randint1(15);
 #else /* ALLOW_CAVERNS_AND_LAKES */
-       vtype = randint(7);
+       vtype = randint1(7);
 #endif /* ALLOW_CAVERNS_AND_LAKES */
 
        switch (vtype)
@@ -4984,9 +4984,9 @@ static void build_type11(int by0, int bx0)
        int light = FALSE;
 
        /* Occasional light */
-       if ((randint(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+       if ((randint1(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
 
-       rad = rand_int(9);
+       rad = randint0(9);
 
        /* Allocate in room_map.  If will not fit, exit */
        if (!room_alloc(rad * 2 + 1, rad * 2 + 1, FALSE, by0, bx0, &x0, &y0)) return;
@@ -5029,15 +5029,15 @@ static void build_type12(int by0, int bx0)
 
        /* Make a random metric */
        int h1, h2, h3, h4;
-       h1 = randint(32) - 16;
-       h2 = randint(16);
-       h3 = randint(32);
-       h4 = randint(32) - 16;
+       h1 = randint1(32) - 16;
+       h2 = randint1(16);
+       h3 = randint1(32);
+       h4 = randint1(32) - 16;
 
        /* Occasional light */
-       if ((randint(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+       if ((randint1(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
 
-       rad = randint(9);
+       rad = randint1(9);
 
        /* Allocate in room_map.  If will not fit, exit */
        if (!room_alloc(rad * 2 + 3, rad * 2 + 3, FALSE, by0, bx0, &x0, &y0)) return;
@@ -5100,10 +5100,10 @@ static void build_type12(int by0, int bx0)
                place_object(y0, x0, FALSE, FALSE);
 
                /* Let's guard the treasure well */
-               vault_monsters(y0, x0, rand_int(2) + 3);
+               vault_monsters(y0, x0, randint0(2) + 3);
 
                /* Traps naturally */
-               vault_traps(y0, x0, 4, 4, rand_int(3) + 2);
+               vault_traps(y0, x0, 4, 4, randint0(3) + 2);
        }
 }
 
index d35e414..4e96f1b 100644 (file)
@@ -1403,7 +1403,7 @@ static bool wr_savefile_new(void)
        wr_byte(FAKE_VER_PATCH);
        xor_byte = 0;
 
-       tmp8u = (byte)rand_int(256);
+       tmp8u = (byte)randint0(256);
        wr_byte(tmp8u);
 
 
index 2e73fc7..c829723 100644 (file)
@@ -58,13 +58,13 @@ static void next_mirror( int* next_y , int* next_x )
        }
        if( mirror_num )
        {
-               num=rand_int(mirror_num);
+               num=randint0(mirror_num);
                *next_y=mirror_y[num];
                *next_x=mirror_x[num];
                return;
        }
-       *next_y=rand_int(cur_hgt);
-       *next_x=rand_int(cur_wid);
+       *next_y=randint0(cur_hgt);
+       *next_x=randint0(cur_wid);
        return;
 }
                
@@ -73,7 +73,7 @@ static void next_mirror( int* next_y , int* next_x )
  */
 static byte mh_attr(int max)
 {
-       switch (randint(max))
+       switch (randint1(max))
        {
                case  1: return (TERM_RED);
                case  2: return (TERM_GREEN);
@@ -177,7 +177,7 @@ static byte spell_color(int type)
                if (!s) return (TERM_WHITE);
 
                /* Pick a random color */
-               c = s[rand_int(strlen(s))];
+               c = s[randint0(strlen(s))];
 
                /* Lookup this color */
                a = strchr(color_char, c) - color_char;
@@ -730,7 +730,7 @@ msg_print("
                                if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
                                else
                                {
-                                       c_ptr->feat = floor_type[rand_int(100)];
+                                       c_ptr->feat = floor_type[randint0(100)];
                                        c_ptr->info &= ~(CAVE_MASK);
                                        c_ptr->info |= CAVE_FLOOR;
                                }
@@ -801,7 +801,7 @@ msg_print("
                                if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
                                else
                                {
-                                       c_ptr->feat = floor_type[rand_int(100)];
+                                       c_ptr->feat = floor_type[randint0(100)];
                                        c_ptr->info &= ~(CAVE_MASK);
                                        c_ptr->info |= CAVE_FLOOR;
                                }
@@ -868,7 +868,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Destroy the wall */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
                        }
@@ -894,7 +894,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Destroy the wall */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
 
@@ -921,7 +921,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Destroy the wall */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
                        }
@@ -945,12 +945,12 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Destroy the rubble */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
 
                                /* Hack -- place an object */
-                               if (rand_int(100) < 10)
+                               if (randint0(100) < 10)
                                {
                                        /* Found something */
                                        if (player_can_see_bold(y, x))
@@ -988,7 +988,7 @@ msg_print("
                                c_ptr->info &= ~(CAVE_MARK);
 
                                /* Destroy the feature */
-                               c_ptr->feat = floor_type[rand_int(100)];
+                               c_ptr->feat = floor_type[randint0(100)];
                                c_ptr->info &= ~(CAVE_MASK);
                                c_ptr->info |= CAVE_FLOOR;
                        }
@@ -1554,8 +1554,8 @@ msg_print("
                                        bool pet = (!who || is_pet(&m_list[who]));
                                        for (i = 0; i < o_ptr->number ; i++)
                                        {
-                                               if (((o_ptr->sval == SV_CORPSE) && (randint(100) > 80)) ||
-                                                   ((o_ptr->sval == SV_SKELETON) && (randint(100) > 60)))
+                                               if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
+                                                   ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
                                                {
                                                        if (!note_kill)
                                                        {
@@ -1692,15 +1692,15 @@ msg_format("%s
  * and hurts evil less.  If can breath nether, then it resists it as well.
  *
  * Damage reductions use the following formulas:
- *   Note that "dam = dam * 6 / (randint(6) + 6);"
+ *   Note that "dam = dam * 6 / (randint1(6) + 6);"
  *     gives avg damage of .655, ranging from .858 to .500
- *   Note that "dam = dam * 5 / (randint(6) + 6);"
+ *   Note that "dam = dam * 5 / (randint1(6) + 6);"
  *     gives avg damage of .544, ranging from .714 to .417
- *   Note that "dam = dam * 4 / (randint(6) + 6);"
+ *   Note that "dam = dam * 4 / (randint1(6) + 6);"
  *     gives avg damage of .444, ranging from .556 to .333
- *   Note that "dam = dam * 3 / (randint(6) + 6);"
+ *   Note that "dam = dam * 3 / (randint1(6) + 6);"
  *     gives avg damage of .327, ranging from .427 to .250
- *   Note that "dam = dam * 2 / (randint(6) + 6);"
+ *   Note that "dam = dam * 2 / (randint1(6) + 6);"
  *     gives something simple.
  *
  * In this function, "result" messages are postponed until the end, where
@@ -2050,7 +2050,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
                        }
                        else if (one_in_(3)) do_poly = TRUE;
@@ -2131,7 +2131,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                        }
                        break;
                }
@@ -2177,7 +2177,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                if (seen)
                                        r_ptr->r_flags3 |= (RF3_RES_PLAS);
                        }
@@ -2218,7 +2218,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
 
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
                        }
@@ -2269,7 +2269,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
                        }
                        break;
@@ -2291,7 +2291,7 @@ note = "
                                break;
                        }
                        do_poly = TRUE;
-                       do_conf = (5 + randint(11) + r) / (r + 1);
+                       do_conf = (5 + randint1(11) + r) / (r + 1);
                        if ((r_ptr->flags4 & RF4_BR_CHAO) ||
                            (m_ptr->r_idx == MON_STORMBRINGER) ||
                            ((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
@@ -2302,7 +2302,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                do_poly = FALSE;
                        }
                        break;
@@ -2331,7 +2331,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                        }
                        break;
                }
@@ -2381,7 +2381,7 @@ note = "
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
                                break;
                        }
-                       do_stun = (10 + randint(15) + r) / (r + 1);
+                       do_stun = (10 + randint1(15) + r) / (r + 1);
                        if (r_ptr->flags4 & RF4_BR_SOUN)
                        {
 #ifdef JP
@@ -2390,7 +2390,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 2; dam /= randint(6) + 6;
+                               dam *= 2; dam /= randint1(6) + 6;
                        }
                        break;
                }
@@ -2410,7 +2410,7 @@ note = "
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
                                break;
                        }
-                       do_conf = (10 + randint(15) + r) / (r + 1);
+                       do_conf = (10 + randint1(15) + r) / (r + 1);
                        if (r_ptr->flags4 & RF4_BR_CONF)
                        {
 #ifdef JP
@@ -2419,7 +2419,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 2; dam /= randint(6) + 6;
+                               dam *= 2; dam /= randint1(6) + 6;
                        }
                        else if (r_ptr->flags3 & RF3_NO_CONF)
                        {
@@ -2457,7 +2457,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
                        }
                        break;
@@ -2486,7 +2486,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
                        }
                        break;
@@ -2507,7 +2507,7 @@ note = "
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
                                break;
                        }
-                       do_stun = (randint(15) + r) / (r + 1);
+                       do_stun = (randint1(15) + r) / (r + 1);
                        if (r_ptr->flags4 & RF4_BR_WALL)
                        {
 #ifdef JP
@@ -2516,7 +2516,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                        }
                        break;
                }
@@ -2544,13 +2544,13 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                        }
                        else
                        {
                                /* Powerful monsters can resist */
                                if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
                                        obvious = FALSE;
                                }
@@ -2596,7 +2596,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                        }
                        else do_time = (dam+1)/2;
                        break;
@@ -2633,7 +2633,7 @@ note = "
 
                                        resist_tele = TRUE;
                                }
-                               else if (r_ptr->level > randint(100))
+                               else if (r_ptr->level > randint1(100))
                                {
                                        if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -2658,7 +2658,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint(6) + 6;
+                               dam *= 3; dam /= randint1(6) + 6;
                                do_dist = 0;
                        }
                        else
@@ -2666,7 +2666,7 @@ note = "
                                /* 1. slowness */
                                /* Powerful monsters can resist */
                                if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
                                        obvious = FALSE;
                                }
@@ -2691,7 +2691,7 @@ note = "
 
                                /* Attempt a saving throw */
                                if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
                                        /* Resist */
                                        do_stun = 0;
@@ -2801,7 +2801,7 @@ note = "
                        else if ((r_ptr->flags2 & RF2_STUPID) ||
                                                (r_ptr->flags2 & RF2_WEIRD_MIND) ||
                                                (r_ptr->flags3 & RF3_ANIMAL) ||
-                                               (r_ptr->level > randint(3 * dam)))
+                                               (r_ptr->level > randint1(3 * dam)))
                        {
                                dam /= 3;
 #ifdef JP
@@ -2830,7 +2830,7 @@ msg_format("%^s
 #endif
 
                                        /* Saving throw */
-                                       if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+                                       if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -2846,13 +2846,13 @@ msg_print("
                                                take_hit(DAMAGE_ATTACK, dam, killer, -1);  /* has already been /3 */
                                                if (one_in_(4))
                                                {
-                                                       switch (randint(4))
+                                                       switch (randint1(4))
                                                        {
                                                                case 1:
-                                                                       set_confused(p_ptr->confused + 3 + randint(dam));
+                                                                       set_confused(p_ptr->confused + 3 + randint1(dam));
                                                                        break;
                                                                case 2:
-                                                                       set_stun(p_ptr->stun + randint(dam));
+                                                                       set_stun(p_ptr->stun + randint1(dam));
                                                                        break;
                                                                case 3:
                                                                {
@@ -2864,12 +2864,12 @@ note = "
 #endif
 
                                                                        else
-                                                                               set_afraid(p_ptr->afraid + 3 + randint(dam));
+                                                                               set_afraid(p_ptr->afraid + 3 + randint1(dam));
                                                                        break;
                                                                }
                                                                default:
                                                                        if (!p_ptr->free_act)
-                                                                               (void)set_paralyzed(p_ptr->paralyzed + randint(dam));
+                                                                               (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
                                                                        break;
                                                        }
                                                }
@@ -2880,16 +2880,16 @@ note = "
 
                        if ((dam > 0) && one_in_(4))
                        {
-                               switch (randint(4))
+                               switch (randint1(4))
                                {
                                        case 1:
-                                               do_conf = 3 + randint(dam);
+                                               do_conf = 3 + randint1(dam);
                                                break;
                                        case 2:
-                                               do_stun = 3 + randint(dam);
+                                               do_stun = 3 + randint1(dam);
                                                break;
                                        case 3:
-                                               do_fear = 3 + randint(dam);
+                                               do_fear = 3 + randint1(dam);
                                                break;
                                        default:
 #ifdef JP
@@ -2898,7 +2898,7 @@ note = "
                                                note = " falls asleep!";
 #endif
 
-                                               do_sleep = 3 + randint(dam);
+                                               do_sleep = 3 + randint1(dam);
                                                break;
                                }
                        }
@@ -2939,7 +2939,7 @@ note = "
                        else if ((r_ptr->flags2 & RF2_STUPID) ||
                                 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
                                 (r_ptr->flags3 & RF3_ANIMAL) ||
-                                               (r_ptr->level > randint(3 * dam)))
+                                               (r_ptr->level > randint1(3 * dam)))
                        {
                                dam /= 3;
 #ifdef JP
@@ -2968,7 +2968,7 @@ msg_format("%^s
 #endif
 
                                        /* Saving throw */
-                                       if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+                                       if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3046,7 +3046,7 @@ note_dies = "
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
-                           (r_ptr->level > 5 + randint(dam)))
+                           (r_ptr->level > 5 + randint1(dam)))
                        {
                                /* Resist */
                                do_stun = 0;
@@ -3112,7 +3112,7 @@ note_dies = "
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                            (r_ptr->flags1 & RF1_QUESTOR) ||
                            (r_ptr->flags3 & RF3_NO_CONF) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_CONF)
@@ -3142,7 +3142,7 @@ msg_format("%^s
 #endif
 
                                        /* Saving throw */
-                                       if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+                                       if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -3154,7 +3154,7 @@ msg_print("
                                        else
                                        {
                                                /* Confuse, stun, terrify */
-                                               switch (randint(4))
+                                               switch (randint1(4))
                                                {
                                                        case 1:
                                                                set_stun(p_ptr->stun + dam / 2);
@@ -3191,7 +3191,7 @@ note = "
                        }
                        else
                        {
-                               if ((dam > 29) && (randint(100) < dam))
+                               if ((dam > 29) && (randint1(100) < dam))
                                {
 #ifdef JP
 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
@@ -3203,7 +3203,7 @@ note = "
                                }
                                else
                                {
-                                       switch (randint(4))
+                                       switch (randint1(4))
                                        {
                                                case 1:
                                                        do_stun = dam / 2;
@@ -3239,7 +3239,7 @@ note = "
                                if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
                                break;
                        }
-                       do_stun = (randint(15) + 1) / (r + 1);
+                       do_stun = (randint1(15) + 1) / (r + 1);
                        if (r_ptr->flags3 & RF3_IM_COLD)
                        {
 #ifdef JP
@@ -3331,9 +3331,9 @@ note = "
                                dam = 0;
                        }
                        else if (((r_ptr->flags1 & RF1_UNIQUE) &&
-                                (randint(888) != 666)) ||
-                                (((r_ptr->level + randint(20)) > randint(p_ptr->lev + randint(10))) &&
-                                randint(100) != 66))
+                                (randint1(888) != 666)) ||
+                                (((r_ptr->level + randint1(20)) > randint1(p_ptr->lev + randint1(10))) &&
+                                randint1(100) != 66))
                        {
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3370,7 +3370,7 @@ note = "
                        /* Powerful monsters can resist */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                            (r_ptr->flags1 & RF1_QUESTOR) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -3579,7 +3579,7 @@ note = "
                        }
                        /* Powerful monsters can resist */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3632,7 +3632,7 @@ note = "
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                            (r_ptr->flags3 & RF3_NO_SLEEP) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_SLEEP)
@@ -3685,7 +3685,7 @@ note = "
                        }
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3750,7 +3750,7 @@ note = "
                        if ((r_ptr->flags1 & RF1_QUESTOR) ||
                            (r_ptr->flags3 & RF3_NO_CONF) ||
                            (m_ptr->mflag2 & MFLAG_NOPET) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_CONF)
@@ -3837,7 +3837,7 @@ note = "
                        if ((r_ptr->flags1 & RF1_QUESTOR) ||
                          (!(r_ptr->flags3 & RF3_UNDEAD)) ||
                            (m_ptr->mflag2 & MFLAG_NOPET) ||
-                                (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* No obvious effect */
 #ifdef JP
@@ -3912,7 +3912,7 @@ note = "
                        if ((r_ptr->flags1 & RF1_QUESTOR) ||
                          (!(r_ptr->flags3 & RF3_DEMON)) ||
                            (m_ptr->mflag2 & MFLAG_NOPET) ||
-                                (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* No obvious effect */
 #ifdef JP
@@ -3989,7 +3989,7 @@ note = "
                          (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
                            (m_ptr->mflag2 & MFLAG_NOPET) ||
                                 (r_ptr->flags3 & (RF3_NO_CONF)) ||
-                                (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
@@ -4084,7 +4084,7 @@ msg_format("%s
                        if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
                            (m_ptr->mflag2 & MFLAG_NOPET) ||
                                 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
-                                ((r_ptr->level+10) > randint(dam)))
+                                ((r_ptr->level+10) > randint1(dam)))
                        {
                                /* Resist */
                                /* No obvious effect */
@@ -4148,7 +4148,7 @@ note = "
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
                            (r_ptr->flags3 & (RF3_NO_CONF)) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
@@ -4193,7 +4193,7 @@ note = "
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Resist */
                                do_stun = 0;
@@ -4284,7 +4284,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 2; dam /= (randint(6)+6);
+                               dam *= 2; dam /= (randint1(6)+6);
                        }
                        else if (r_ptr->flags3 & (RF3_HURT_LITE))
                        {
@@ -4330,7 +4330,7 @@ note = "
                                note = " resists.";
 #endif
 
-                               dam *= 2; dam /= (randint(6)+6);
+                               dam *= 2; dam /= (randint1(6)+6);
                        }
                        break;
                }
@@ -4396,7 +4396,7 @@ note = "
 
                                                resists_tele = TRUE;
                                        }
-                                       else if (r_ptr->level > randint(100))
+                                       else if (r_ptr->level > randint1(100))
                                        {
                                                if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -4451,7 +4451,7 @@ note = "
 
                                                resists_tele = TRUE;
                                        }
-                                       else if (r_ptr->level > randint(100))
+                                       else if (r_ptr->level > randint1(100))
                                        {
                                                if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -4502,7 +4502,7 @@ note = "
 
                                        resists_tele = TRUE;
                                }
-                               else if (r_ptr->level > randint(100))
+                               else if (r_ptr->level > randint1(100))
                                {
                                        if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
 #ifdef JP
@@ -4551,7 +4551,7 @@ note = "
                                do_fear = damroll(3, (dam / 2)) + 1;
 
                                /* Attempt a saving throw */
-                               if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
+                               if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
                                {
                                        /* No obvious effect */
 #ifdef JP
@@ -4599,7 +4599,7 @@ note = "
                                do_fear = damroll(3, (dam / 2)) + 1;
 
                                /* Attempt a saving throw */
-                               if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
+                               if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
                                {
                                        /* No obvious effect */
 #ifdef JP
@@ -4643,7 +4643,7 @@ note = "
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
                            (r_ptr->flags3 & (RF3_NO_FEAR)) ||
-                           (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                           (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* No obvious effect */
 #ifdef JP
@@ -4960,7 +4960,7 @@ msg_format("%s
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                                 (r_ptr->flags3 & RF3_NO_CONF) ||
-                                (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+                                (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
@@ -4984,7 +4984,7 @@ note_dies = "
                                note_dies = " collapses, a mindless husk.";
 #endif
 
-                               do_conf = rand_int(8) + 8;
+                               do_conf = randint0(8) + 8;
                        }
                        break;
                }
@@ -5015,7 +5015,7 @@ msg_format("%s
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                                 (r_ptr->flags3 & RF3_NO_CONF) ||
-                                (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+                                (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
@@ -5039,8 +5039,8 @@ note_dies = "
                                note_dies = " collapses, a mindless husk.";
 #endif
 
-                               do_conf = rand_int(8) + 8;
-                               do_stun = rand_int(8) + 8;
+                               do_conf = randint0(8) + 8;
+                               do_stun = randint0(8) + 8;
                                m_ptr->slow = MIN(200, m_ptr->slow + 10);
                                if (c_ptr->m_idx == p_ptr->riding)
                                        p_ptr->update |= (PU_BONUS);
@@ -5072,7 +5072,7 @@ msg_format("%s
                        }
 
                        /* Attempt a saving throw */
-                       if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5109,7 +5109,7 @@ msg_format("%s
                        }
 
                        /* Attempt a saving throw */
-                       if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5146,7 +5146,7 @@ msg_format("%s
                        }
 
                        /* Attempt a saving throw */
-                       if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5183,7 +5183,7 @@ msg_format("%s
                        }
 
                        /* Attempt a saving throw */
-                       if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5224,10 +5224,10 @@ note = "
                        }
                        else
                        {
-                               if ((p_ptr->lev + randint(dam)) >
-                                       (r_ptr->level + randint(200)))
+                               if ((p_ptr->lev + randint1(dam)) >
+                                       (r_ptr->level + randint1(200)))
                                        {
-                                               dam = ((40 + randint(20)) * m_ptr->hp) / 100;
+                                               dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
 
                                                if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
                                        }
@@ -5275,7 +5275,7 @@ msg_format("
 #endif
                                skipped = TRUE;
                        }
-                       else if (m_ptr->hp < rand_int(nokori_hp))
+                       else if (m_ptr->hp < randint0(nokori_hp))
                        {
                                if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
 #ifdef JP
@@ -5427,7 +5427,7 @@ note = "
                        {
                                /* Powerful monsters can resist */
                                if ((r_ptr->flags1 & RF1_UNIQUE) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -5462,7 +5462,7 @@ note = "
 
                                /* Attempt a saving throw */
                                if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
                                        /* Resist */
                                        do_stun = 0;
@@ -5483,7 +5483,7 @@ note = "
                                /* Attempt a saving throw */
                                if ((r_ptr->flags1 & RF1_UNIQUE) ||
                                    (r_ptr->flags3 & RF3_NO_SLEEP) ||
-                                   (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+                                   (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                                {
                                        /* Memorize a flag */
                                        if (r_ptr->flags3 & RF3_NO_SLEEP)
@@ -5552,7 +5552,7 @@ note = "
                        }
                        else
                        {
-                               if ((r_ptr->level > rand_int(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
+                               if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
                                {
                                        dam = 0;
                                        angry = TRUE;
@@ -5567,9 +5567,9 @@ note = "
 #endif
 
 #ifdef JP
-                                       take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+                                       take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                                       take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
+                                       take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
 #endif
                                        dam = 0;
 
@@ -5710,7 +5710,7 @@ note_dies = "
        }
 
        /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
-       else if (do_poly && (randint(90) > r_ptr->level))
+       else if (do_poly && (randint1(90) > r_ptr->level))
        {
                if (polymorph_monster(y, x))
                {
@@ -6031,7 +6031,7 @@ msg_format("%^s
                int count = 0;
                do
                {
-                       switch (randint(28))
+                       switch (randint1(28))
                        {
                        case 1: case 2:
                                if (!count)
@@ -6042,7 +6042,7 @@ msg_print("
                                        msg_print("The ground trembles...");
 #endif
 
-                                       earthquake(ty, tx, 4 + rand_int(4));
+                                       earthquake(ty, tx, 4 + randint0(4));
                                        if (!one_in_(6)) break;
                                }
                        case 3: case 4: case 5: case 6:
@@ -6098,11 +6098,11 @@ msg_print("
                                {
                                        pet = TRUE;
                                }
-                               count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
+                               count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
                                if (!one_in_(6)) break;
                        }
                        case 23: case 24: case 25:
-                               if (p_ptr->hold_life && (rand_int(100) < 75)) break;
+                               if (p_ptr->hold_life && (randint0(100) < 75)) break;
 #ifdef JP
 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
 #else
@@ -6130,7 +6130,7 @@ msg_print("
                                }
                                else
                                {
-                                       (void)do_dec_stat(rand_int(6));
+                                       (void)do_dec_stat(randint0(6));
                                }
                                break;
                        }
@@ -6262,7 +6262,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
        /* Player is not here */
        if ((x != px) || (y != py)) return (FALSE);
 
-       if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (rand_int(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
+       if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
        {
                kawarimi(TRUE);
                return FALSE;
@@ -6290,8 +6290,8 @@ else msg_print("
                /* Choose 'new' target */
                do
                {
-                       t_y = m_list[who].fy - 1 + randint(3);
-                       t_x = m_list[who].fx - 1 + randint(3);
+                       t_y = m_list[who].fy - 1 + randint1(3);
+                       t_x = m_list[who].fx - 1 + randint1(3);
                        max_attempts--;
                }
                while (max_attempts && in_bounds2u(t_y, t_x) &&
@@ -6408,7 +6408,7 @@ if (fuzzy) msg_print("
 
                        if (!(double_resist || p_ptr->resist_pois))
                        {
-                               set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
+                               set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
                        }
                        break;
                }
@@ -6428,7 +6428,7 @@ if (fuzzy) msg_print("
                        take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        if (!(double_resist || p_ptr->resist_pois))
                        {
-                               set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
+                               set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
 
                                if (one_in_(5)) /* 6 */
                                {
@@ -6531,7 +6531,7 @@ if (fuzzy) msg_print("
 
                        if (!p_ptr->resist_sound)
                        {
-                               int k = (randint((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
+                               int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
                                (void)set_stun(p_ptr->stun + k);
                        }
 
@@ -6559,11 +6559,11 @@ if (fuzzy) msg_print("
                        if (p_ptr->resist_neth)
                        {
                                if (!prace_is_(RACE_SPECTRE))
-                                       dam *= 6; dam /= (randint(4) + 7);
+                                       dam *= 6; dam /= (randint1(4) + 7);
                        }
                        else if (p_ptr->prace != RACE_ANDROID)
                        {
-                               if (p_ptr->hold_life && (rand_int(100) < 75))
+                               if (p_ptr->hold_life && (randint0(100) < 75))
                                {
 #ifdef JP
 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -6624,11 +6624,11 @@ if (fuzzy) msg_print("
 
                        if (!p_ptr->resist_sound)
                        {
-                               set_stun(p_ptr->stun + randint(40));
+                               set_stun(p_ptr->stun + randint1(40));
                        }
                        if (!p_ptr->resist_conf)
                        {
-                               set_confused(p_ptr->confused + randint(5) + 5);
+                               set_confused(p_ptr->confused + randint1(5) + 5);
                        }
 
                        if (one_in_(5))
@@ -6651,15 +6651,15 @@ if (fuzzy) msg_print("̵
 
                        if (p_ptr->resist_chaos)
                        {
-                               dam *= 6; dam /= (randint(4) + 7);
+                               dam *= 6; dam /= (randint1(4) + 7);
                        }
                        if (!p_ptr->resist_conf)
                        {
-                               (void)set_confused(p_ptr->confused + rand_int(20) + 10);
+                               (void)set_confused(p_ptr->confused + randint0(20) + 10);
                        }
                        if (!p_ptr->resist_chaos)
                        {
-                               (void)set_image(p_ptr->image + randint(10));
+                               (void)set_image(p_ptr->image + randint1(10));
                                if (one_in_(3))
                                {
 #ifdef JP
@@ -6676,7 +6676,7 @@ msg_print("
                                if (p_ptr->prace == RACE_ANDROID)
                                {
                                }
-                               else if (p_ptr->hold_life && (rand_int(100) < 75))
+                               else if (p_ptr->hold_life && (randint0(100) < 75))
                                {
 #ifdef JP
 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
@@ -6726,7 +6726,7 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_shard)
                        {
-                               dam *= 6; dam /= (randint(4) + 7);
+                               dam *= 6; dam /= (randint1(4) + 7);
                        }
                        else
                        {
@@ -6753,11 +6753,11 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_sound)
                        {
-                               dam *= 5; dam /= (randint(4) + 7);
+                               dam *= 5; dam /= (randint1(4) + 7);
                        }
                        else
                        {
-                               int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
+                               int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
                                (void)set_stun(p_ptr->stun + k);
                        }
 
@@ -6781,11 +6781,11 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_conf)
                        {
-                               dam *= 5; dam /= (randint(4) + 7);
+                               dam *= 5; dam /= (randint1(4) + 7);
                        }
                        if (!p_ptr->resist_conf)
                        {
-                               (void)set_confused(p_ptr->confused + randint(20) + 10);
+                               (void)set_confused(p_ptr->confused + randint1(20) + 10);
                        }
                        take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        break;
@@ -6802,7 +6802,7 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_disen)
                        {
-                               dam *= 6; dam /= (randint(4) + 7);
+                               dam *= 6; dam /= (randint1(4) + 7);
                        }
                        else
                        {
@@ -6823,7 +6823,7 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_nexus)
                        {
-                               dam *= 6; dam /= (randint(4) + 7);
+                               dam *= 6; dam /= (randint1(4) + 7);
                        }
                        else
                        {
@@ -6844,7 +6844,7 @@ if (fuzzy) msg_print("
 
                        if (!p_ptr->resist_sound)
                        {
-                               (void)set_stun(p_ptr->stun + randint(20));
+                               (void)set_stun(p_ptr->stun + randint1(20));
                        }
                        take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        break;
@@ -6862,7 +6862,7 @@ if (fuzzy) msg_print("
 
                        if (!p_ptr->resist_sound)
                        {
-                               (void)set_stun(p_ptr->stun + randint(20));
+                               (void)set_stun(p_ptr->stun + randint1(20));
                        }
                        if (p_ptr->resist_shard)
                        {
@@ -6891,7 +6891,7 @@ if (fuzzy) msg_print("
                        if (fuzzy) msg_print("You are hit by something slow!");
 #endif
 
-                       (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+                       (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
                        take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        break;
                }
@@ -6907,11 +6907,11 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_lite)
                        {
-                               dam *= 4; dam /= (randint(4) + 7);
+                               dam *= 4; dam /= (randint1(4) + 7);
                        }
                        else if (!blind && !p_ptr->resist_blind)
                        {
-                               (void)set_blind(p_ptr->blind + randint(5) + 2);
+                               (void)set_blind(p_ptr->blind + randint1(5) + 2);
                        }
                        if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
                        {
@@ -6964,13 +6964,13 @@ if (fuzzy) msg_print("
 
                        if (p_ptr->resist_dark)
                        {
-                               dam *= 4; dam /= (randint(4) + 7);
+                               dam *= 4; dam /= (randint1(4) + 7);
 
                                if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
                        }
                        else if (!blind && !p_ptr->resist_blind)
                        {
-                               (void)set_blind(p_ptr->blind + randint(5) + 2);
+                               (void)set_blind(p_ptr->blind + randint1(5) + 2);
                        }
                        take_hit(DAMAGE_ATTACK, dam, killer, monspell);
                        break;
@@ -6988,7 +6988,7 @@ if (fuzzy) msg_print("
                        if (p_ptr->resist_time)
                        {
                                dam *= 4;
-                               dam /= (randint(4) + 7);
+                               dam /= (randint1(4) + 7);
 #ifdef JP
 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
 #else
@@ -6998,7 +6998,7 @@ msg_print("
                        }
                        else
                        {
-                               switch (randint(10))
+                               switch (randint1(10))
                                {
                                        case 1: case 2: case 3: case 4: case 5:
                                        {
@@ -7015,7 +7015,7 @@ msg_print("
 
                                        case 6: case 7: case 8: case 9:
                                        {
-                                               switch (randint(6))
+                                               switch (randint1(6))
                                                {
 #ifdef JP
 case 1: k = A_STR; act = "¶¯¤¯"; break;
@@ -7085,10 +7085,10 @@ msg_print("
 
                        teleport_player(5);
                        if (!p_ptr->ffall)
-                               (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+                               (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
                        if (!(p_ptr->resist_sound || p_ptr->ffall))
                        {
-                               int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
+                               int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
                                (void)set_stun(p_ptr->stun + k);
                        }
                        if (p_ptr->ffall)
@@ -7139,7 +7139,7 @@ if (fuzzy) msg_print("
                        if (fuzzy) msg_print("You are hit by something!");
 #endif
 
-                       (void)set_fast(p_ptr->fast + randint(5), FALSE);
+                       (void)set_fast(p_ptr->fast + randint1(5), FALSE);
                        dam = 0;
                        break;
                }
@@ -7152,7 +7152,7 @@ if (fuzzy) msg_print("
                        if (fuzzy) msg_print("You are hit by something slow!");
 #endif
 
-                       (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+                       (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
                        break;
                }
 
@@ -7253,7 +7253,7 @@ if (fuzzy) msg_print("
                        }
                        if (!p_ptr->resist_sound)
                        {
-                               (void)set_stun(p_ptr->stun + randint(15));
+                               (void)set_stun(p_ptr->stun + randint1(15));
                        }
 
                        if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
@@ -7645,7 +7645,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte
                                                                cave_set_feat(y, x, FEAT_GRASS);
                                                        else
                                                        {
-                                                               cave[y][x].feat = floor_type[rand_int(100)];
+                                                               cave[y][x].feat = floor_type[randint0(100)];
                                                                cave[y][x].info &= ~(CAVE_MASK);
                                                                cave[y][x].info |= CAVE_FLOOR;
                                                        }
@@ -8426,7 +8426,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                                                        cave_set_feat(y, x, FEAT_GRASS);
                                                                else
                                                                {
-                                                                       cave[y][x].feat = floor_type[rand_int(100)];
+                                                                       cave[y][x].feat = floor_type[randint0(100)];
                                                                        cave[y][x].info &= ~(CAVE_MASK);
                                                                        cave[y][x].info |= CAVE_FLOOR;
                                                                }
@@ -8662,8 +8662,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                        /* Choose 'new' target */
                                        do
                                        {
-                                               t_y = y_saver - 1 + randint(3);
-                                               t_x = x_saver - 1 + randint(3);
+                                               t_y = y_saver - 1 + randint1(3);
+                                               t_x = x_saver - 1 + randint1(3);
                                                max_attempts--;
                                        }
 
@@ -8841,9 +8841,9 @@ bool binding_field( int dam )
 
        if( mirror_num < 2 )return FALSE;
 
-       point_x[0] = rand_int( mirror_num );
+       point_x[0] = randint0( mirror_num );
        do {
-         point_x[1] = rand_int( mirror_num );
+         point_x[1] = randint0( mirror_num );
        }
        while( point_x[0] == point_x[1] );
 
index 2c27729..eb65f7b 100644 (file)
@@ -4431,7 +4431,7 @@ while(!get_com("
 
                else if (i == p_ptr->riding) angry = TRUE;
 
-               else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
                else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
 
@@ -4480,9 +4480,9 @@ msg_format("%^s
                {
                        /* Take damage */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                       take_hit(DAMAGE_GENO, randint(4), "the strain of casting Genocide", -1);
+                       take_hit(DAMAGE_GENO, randint1(4), "the strain of casting Genocide", -1);
 #endif
 
                }
@@ -4560,7 +4560,7 @@ bool mass_genocide(int power, int player_cast)
 
                else if (i == p_ptr->riding) angry = TRUE;
 
-               else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
                else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
 
@@ -4609,9 +4609,9 @@ msg_format("%^s
                {
                        /* Hack -- visual feedback */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                       take_hit(DAMAGE_GENO, randint(3), "the strain of casting Mass Genocide", -1);
+                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
 #endif
 
                }
@@ -4692,7 +4692,7 @@ bool mass_genocide_undead(int power, int player_cast)
 
                else if (i == p_ptr->riding) angry = TRUE;
 
-               else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
                else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
 
@@ -4741,9 +4741,9 @@ msg_format("%^s
                {
                        /* Hack -- visual feedback */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                       take_hit(DAMAGE_GENO, randint(3), "the strain of casting Mass Genocide", -1);
+                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
 #endif
 
                }
@@ -5021,7 +5021,7 @@ bool destroy_area(int y1, int x1, int r, int full)
                        if (!cave_perma_bold(y, x))
                        {
                                /* Wall (or floor) type */
-                               t = rand_int(200);
+                               t = randint0(200);
 
                                /* Granite */
                                if (t < 20)
@@ -5048,7 +5048,7 @@ bool destroy_area(int y1, int x1, int r, int full)
                                else
                                {
                                        /* Create floor */
-                                       c_ptr->feat = floor_type[rand_int(100)];
+                                       c_ptr->feat = floor_type[randint0(100)];
                                        c_ptr->info &= ~(CAVE_MASK);
                                        c_ptr->info |= CAVE_FLOOR;
                                }
@@ -5072,7 +5072,7 @@ msg_print("dz
                if (!p_ptr->resist_blind && !p_ptr->resist_lite)
                {
                        /* Become blind */
-                       (void)set_blind(p_ptr->blind + 10 + randint(10));
+                       (void)set_blind(p_ptr->blind + 10 + randint1(10));
                }
        }
 
@@ -5172,7 +5172,7 @@ bool earthquake(int cy, int cx, int r)
                        if (!dx && !dy) continue;
 
                        /* Skip most grids */
-                       if (rand_int(100) < 85) continue;
+                       if (randint0(100) < 85) continue;
 
                        /* Damage this grid */
                        map[16+yy-cy][16+xx-cx] = TRUE;
@@ -5204,14 +5204,14 @@ bool earthquake(int cy, int cx, int r)
                        sn++;
 
                        /* Randomize choice */
-                       if (rand_int(sn) > 0) continue;
+                       if (randint0(sn) > 0) continue;
 
                        /* Save the safe location */
                        sy = y; sx = x;
                }
 
                /* Random message */
-               switch (randint(3))
+               switch (randint1(3))
                {
                        case 1:
                        {
@@ -5262,7 +5262,7 @@ msg_print("
                else
                {
                        /* Calculate results */
-                       switch (randint(3))
+                       switch (randint1(3))
                        {
                                case 1:
                                {
@@ -5284,7 +5284,7 @@ msg_print("
 #endif
 
                                        damage = damroll(10, 4);
-                                       (void)set_stun(p_ptr->stun + randint(50));
+                                       (void)set_stun(p_ptr->stun + randint1(50));
                                        break;
                                }
                                case 3:
@@ -5296,7 +5296,7 @@ msg_print("
 #endif
 
                                        damage = damroll(10, 4);
-                                       (void)set_stun(p_ptr->stun + randint(50));
+                                       (void)set_stun(p_ptr->stun + randint1(50));
                                        break;
                                }
                        }
@@ -5416,7 +5416,7 @@ if (damage) take_hit(DAMAGE_ATTACK, damage, "
                                                        sn++;
 
                                                        /* Randomize choice */
-                                                       if (rand_int(sn) > 0) continue;
+                                                       if (randint0(sn) > 0) continue;
 
                                                        /* Save the safe grid */
                                                        sy = y; sx = x;
@@ -5528,7 +5528,7 @@ msg_format("%^s
                                delete_object(yy, xx);
 
                                /* Wall (or floor) type */
-                               t = (floor ? rand_int(100) : 200);
+                               t = (floor ? randint0(100) : 200);
 
                                /* Granite */
                                if (t < 20)
@@ -5555,7 +5555,7 @@ msg_format("%^s
                                else
                                {
                                        /* Create floor */
-                                       c_ptr->feat = floor_type[rand_int(100)];
+                                       c_ptr->feat = floor_type[randint0(100)];
                                        c_ptr->info &= ~(CAVE_MASK);
                                        c_ptr->info |= CAVE_FLOOR;
                                }
@@ -5696,7 +5696,7 @@ static void cave_temp_room_lite(void)
                        if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
 
                        /* Sometimes monsters wake up */
-                       if (m_ptr->csleep && (rand_int(100) < chance))
+                       if (m_ptr->csleep && (randint0(100) < chance))
                        {
                                /* Wake up! */
                                m_ptr->csleep = 0;
@@ -6278,7 +6278,7 @@ bool fire_beam(int typ, int dir, int dam)
  */
 bool fire_bolt_or_beam(int prob, int typ, int dir, int dam)
 {
-       if (rand_int(100) < prob)
+       if (randint0(100) < prob)
        {
                return (fire_beam(typ, dir, dam));
        }
@@ -6309,14 +6309,14 @@ bool drain_life(int dir, int dam)
 bool wall_to_mud(int dir)
 {
        int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-       return (project_hook(GF_KILL_WALL, dir, 20 + randint(30), flg));
+       return (project_hook(GF_KILL_WALL, dir, 20 + randint1(30), flg));
 }
 
 
 bool wizard_lock(int dir)
 {
        int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-       return (project_hook(GF_JAM_DOOR, dir, 20 + randint(30), flg));
+       return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
 }
 
 
@@ -6511,7 +6511,7 @@ void call_chaos(void)
                GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
        };
 
-       Chaos_type = hurt_types[rand_int(31)];
+       Chaos_type = hurt_types[randint0(31)];
        if (one_in_(4)) line_chaos = TRUE;
 
        if (one_in_(6))
@@ -6555,7 +6555,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
 
        do
        {
-               switch (randint(34))
+               switch (randint1(34))
                {
                case 28: case 29:
                        if (!(*count))
@@ -6566,7 +6566,7 @@ msg_print("
                                msg_print("The ground trembles...");
 #endif
 
-                               earthquake(py, px, 5 + rand_int(10));
+                               earthquake(py, px, 5 + randint0(10));
                                if (!one_in_(6)) break;
                        }
                case 30: case 31:
@@ -6597,7 +6597,7 @@ msg_print("
 #endif
 
                                teleport_player(damroll(10, 10));
-                               if (rand_int(13)) (*count) += activate_hi_summon(py, px, FALSE);
+                               if (randint0(13)) (*count) += activate_hi_summon(py, px, FALSE);
                                if (!one_in_(6)) break;
                        }
                case 34:
@@ -6608,7 +6608,7 @@ msg_print("
 #endif
 
                        wall_breaker();
-                       if (!rand_int(7))
+                       if (!randint0(7))
                        {
                                project(0, 7, py, px, 50, GF_KILL_WALL, flg, -1);
 #ifdef JP
@@ -6637,7 +6637,7 @@ msg_print("
                        lose_exp(p_ptr->exp / 16);
                        if (!one_in_(6)) break;
                case 13: case 14: case 15: case 19: case 20:
-                       if (stop_ty || (p_ptr->free_act && (randint(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
+                       if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
                        {
                                /* Do nothing */ ;
                        }
@@ -6650,14 +6650,14 @@ msg_print("Ħ
 #endif
 
                                if (p_ptr->free_act)
-                                       set_paralyzed(p_ptr->paralyzed + randint(3));
+                                       set_paralyzed(p_ptr->paralyzed + randint1(3));
                                else
-                                       set_paralyzed(p_ptr->paralyzed + randint(13));
+                                       set_paralyzed(p_ptr->paralyzed + randint1(13));
                                stop_ty = TRUE;
                        }
                        if (!one_in_(6)) break;
                case 21: case 22: case 23:
-                       (void)do_dec_stat(rand_int(6));
+                       (void)do_dec_stat(randint0(6));
                        if (!one_in_(6)) break;
                case 24:
 #ifdef JP
@@ -6718,11 +6718,11 @@ int activate_hi_summon(int y, int x, bool can_pet)
        }
        not_pet = (bool)(!pet);
 
-       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint(p_ptr->lev / 2) : dun_level);
+       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
 
-       for (i = 0; i < (randint(7) + (dun_level / 40)); i++)
+       for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
        {
-               switch (randint(25) + (dun_level / 20))
+               switch (randint1(25) + (dun_level / 20))
                {
                        case 1: case 2:
                                count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, TRUE, friendly, pet, FALSE, not_pet);
@@ -6778,7 +6778,7 @@ int activate_hi_summon(int y, int x, bool can_pet)
 int summon_cyber(int who, int y, int x)
 {
        int i;
-       int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint(2));
+       int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
        int count = 0;
 
        bool friendly = FALSE;
@@ -6809,7 +6809,7 @@ void wall_breaker(void)
        int y, x;
        int attempts = 1000;
 
-       if (randint(80 + p_ptr->lev) < 70)
+       if (randint1(80 + p_ptr->lev) < 70)
        {
                while(attempts--)
                {
@@ -6820,10 +6820,10 @@ void wall_breaker(void)
                        if ((y != py) || (x != px)) break;
                }
 
-               project(0, 0, y, x, 20 + randint(30), GF_KILL_WALL,
+               project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
                                  (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
        }
-       else if (randint(100) > 30)
+       else if (randint1(100) > 30)
        {
                earthquake(py, px, 1);
        }
@@ -6840,7 +6840,7 @@ void wall_breaker(void)
                                if ((y != py) && (x != px)) break;
                        }
 
-                       project(0, 0, y, x, 20 + randint(30), GF_KILL_WALL,
+                       project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
                                          (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                }
        }
@@ -6979,7 +6979,7 @@ void kawarimi(bool success)
        int y, x;
 
        if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return;
-       if (rand_int(200) < p_ptr->stun) return;
+       if (randint0(200) < p_ptr->stun) return;
 
        if (!success && one_in_(3))
        {
@@ -6996,7 +6996,7 @@ void kawarimi(bool success)
        y = py;
        x = px;
 
-       teleport_player(10+randint(90));
+       teleport_player(10+randint1(90));
 
        object_wipe(q_ptr);
 
index 56fb157..16838df 100644 (file)
@@ -49,7 +49,7 @@ bool teleport_away(int m_idx, int dis, bool dec_valour)
 
        if (dec_valour &&
            (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
-               (4+randint(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
+               (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
        {       
                chg_virtue(V_VALOUR, -1);
        }
@@ -155,7 +155,7 @@ void teleport_to_player(int m_idx, int power)
        if (!m_ptr->r_idx) return;
 
        /* "Skill" test */
-       if (randint(100) > power) return;
+       if (randint1(100) > power) return;
 
        /* Initialize */
        ny = m_ptr->fy;
@@ -614,7 +614,7 @@ msg_print("
                p_ptr->inside_quest = 0;
                p_ptr->leaving = TRUE;
        }
-       else if (rand_int(100) < 50)
+       else if (randint0(100) < 50)
        {
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤ­ÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
@@ -812,7 +812,7 @@ msg_print("ĥ
 
 bool word_of_recall(void)
 {
-       return(recall_player(rand_int(21) + 15));
+       return(recall_player(randint0(21) + 15));
 }
 
 
@@ -898,7 +898,7 @@ bool apply_disenchant(int mode)
 
 
        /* Pick a random slot */
-       switch (randint(8))
+       switch (randint1(8))
        {
                case 1: t = INVEN_RARM; break;
                case 2: t = INVEN_LARM; break;
@@ -930,7 +930,7 @@ bool apply_disenchant(int mode)
 
 
        /* Artifacts have 71% chance to resist */
-       if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 71))
+       if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 71))
        {
                /* Message */
 #ifdef JP
@@ -949,15 +949,15 @@ msg_format("%s(%c)
 
        /* Disenchant tohit */
        if (o_ptr->to_h > 0) o_ptr->to_h--;
-       if ((o_ptr->to_h > 5) && (rand_int(100) < 20)) o_ptr->to_h--;
+       if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
 
        /* Disenchant todam */
        if (o_ptr->to_d > 0) o_ptr->to_d--;
-       if ((o_ptr->to_d > 5) && (rand_int(100) < 20)) o_ptr->to_d--;
+       if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
 
        /* Disenchant toac */
        if (o_ptr->to_a > 0) o_ptr->to_a--;
-       if ((o_ptr->to_a > 5) && (rand_int(100) < 20)) o_ptr->to_a--;
+       if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
 
        /* Message */
 #ifdef JP
@@ -990,8 +990,8 @@ void mutate_player(void)
        int max1, cur1, max2, cur2, ii, jj, i;
 
        /* Pick a pair of stats */
-       ii = rand_int(6);
-       for (jj = ii; jj == ii; jj = rand_int(6)) /* loop */;
+       ii = randint0(6);
+       for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
 
        max1 = p_ptr->stat_max[ii];
        cur1 = p_ptr->stat_cur[ii];
@@ -1018,7 +1018,7 @@ void mutate_player(void)
  */
 void apply_nexus(monster_type *m_ptr)
 {
-       switch (randint(7))
+       switch (randint1(7))
        {
                case 1: case 2: case 3:
                {
@@ -1034,7 +1034,7 @@ void apply_nexus(monster_type *m_ptr)
 
                case 6:
                {
-                       if (rand_int(100) < p_ptr->skill_sav)
+                       if (randint0(100) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -1052,7 +1052,7 @@ msg_print("
 
                case 7:
                {
-                       if (rand_int(100) < p_ptr->skill_sav)
+                       if (randint0(100) < p_ptr->skill_sav)
                        {
 #ifdef JP
 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
@@ -1343,7 +1343,7 @@ act = "
 #endif
 
                        o_ptr->name2 = EGO_TRUMP;
-                       o_ptr->pval = randint(2);
+                       o_ptr->pval = randint1(2);
                        break;
                case 4:
 #ifdef JP
@@ -1399,7 +1399,7 @@ msg_format("
 #endif
 
 
-               enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+               enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
 
                o_ptr->discount = 99;
                chg_virtue(V_ENCHANT, 2);
@@ -1462,7 +1462,7 @@ msg_print("
 #endif
 
 
-               if (destroy_area(py, px, 15 + p_ptr->lev + rand_int(11), TRUE))
+               if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), TRUE))
 #ifdef JP
 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
 #else
@@ -1478,9 +1478,9 @@ msg_print("
 
 
 #ifdef JP
-take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
+take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
 #else
-               take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "a suicidal Call the Void", -1);
+               take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
 #endif
 
        }
@@ -2037,7 +2037,7 @@ msg_print("
                /* Quest level */
                cave_set_feat(py, px, FEAT_LESS);
        }
-       else if (rand_int(100) < 50)
+       else if (randint0(100) < 50)
        {
                cave_set_feat(py, px, FEAT_MORE);
        }
@@ -2213,7 +2213,7 @@ static void break_curse(object_type *o_ptr)
        /* Extract the flags */
        object_flags(o_ptr, &f1, &f2, &f3);
 
-       if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (rand_int(100) < 25))
+       if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (randint0(100) < 25))
        {
 #ifdef JP
 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
@@ -2271,7 +2271,7 @@ bool enchant(object_type *o_ptr, int n, int eflag)
        for (i = 0; i < n; i++)
        {
                /* Hack -- Roll for pile resistance */
-               if (!force && rand_int(prob) >= 100) continue;
+               if (!force && randint0(prob) >= 100) continue;
 
                /* Enchant to hit */
                if (eflag & ENCH_TOHIT)
@@ -2280,7 +2280,7 @@ bool enchant(object_type *o_ptr, int n, int eflag)
                        else if (o_ptr->to_h > 15) chance = 1000;
                        else chance = enchant_table[o_ptr->to_h];
 
-                       if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+                       if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
                        {
                                o_ptr->to_h++;
                                res = TRUE;
@@ -2298,7 +2298,7 @@ bool enchant(object_type *o_ptr, int n, int eflag)
                        else if (o_ptr->to_d > 15) chance = 1000;
                        else chance = enchant_table[o_ptr->to_d];
 
-                       if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+                       if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
                        {
                                o_ptr->to_d++;
                                res = TRUE;
@@ -2316,7 +2316,7 @@ bool enchant(object_type *o_ptr, int n, int eflag)
                        else if (o_ptr->to_a > 15) chance = 1000;
                        else chance = enchant_table[o_ptr->to_a];
 
-                       if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+                       if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
                        {
                                o_ptr->to_a++;
                                res = TRUE;
@@ -3051,13 +3051,13 @@ s = "
                else
                {
                        /* Recharge based on the standard number of charges. */
-                       recharge_amount = randint(1 + k_ptr->pval / 2);
+                       recharge_amount = randint1(1 + k_ptr->pval / 2);
 
                        /* Multiple wands in a stack increase recharging somewhat. */
                        if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
                        {
                                recharge_amount +=
-                                       (randint(recharge_amount * (o_ptr->number - 1))) / 2;
+                                       (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
                                if (recharge_amount < 1) recharge_amount = 1;
                                if (recharge_amount > 12) recharge_amount = 12;
                        }
@@ -3323,7 +3323,7 @@ s = "
 
        if (o_ptr->ident & IDENT_CURSED)
        {
-               if (((f3 & TR3_HEAVY_CURSE) && (randint(100) < 33)) ||
+               if (((f3 & TR3_HEAVY_CURSE) && (randint1(100) < 33)) ||
                    (f3 & TR3_PERMA_CURSE))
                {
 #ifdef JP
@@ -3417,7 +3417,7 @@ msg_print("
                        dis_happened = TRUE;
                }
 
-               if ((o_ptr->to_h > 5) && (rand_int(100) < 33)) o_ptr->to_h--;
+               if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
 
                /* Disenchant todam */
                if (o_ptr->to_d > 0)
@@ -3426,7 +3426,7 @@ msg_print("
                        dis_happened = TRUE;
                }
 
-               if ((o_ptr->to_d > 5) && (rand_int(100) < 33)) o_ptr->to_d--;
+               if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
 
                /* Disenchant toac */
                if (o_ptr->to_a > 0)
@@ -3435,7 +3435,7 @@ msg_print("
                        dis_happened = TRUE;
                }
 
-               if ((o_ptr->to_a > 5) && (rand_int(100) < 33)) o_ptr->to_a--;
+               if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
 
                if (dis_happened)
                {
@@ -3526,7 +3526,7 @@ msg_format("%s
                    ((o_ptr->number > 1) ? "" : "s"));
 #endif
                o_ptr->name2 = EGO_REFLECTION;
-               enchant(o_ptr, rand_int(3) + 4, ENCH_TOAC);
+               enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
 
                o_ptr->discount = 99;
                chg_virtue(V_ENCHANT, 2);
@@ -4873,7 +4873,7 @@ int inven_damage(inven_func typ, int perc)
                        /* Count the casualties */
                        for (amt = j = 0; j < o_ptr->number; ++j)
                        {
-                               if (rand_int(100) < perc) amt++;
+                               if (randint0(100) < perc) amt++;
                        }
 
                        /* Some casualities */
@@ -4946,7 +4946,7 @@ static int minus_ac(void)
 
 
        /* Pick a (possibly empty) inventory slot */
-       switch (randint(7))
+       switch (randint1(7))
        {
                case 1: o_ptr = &inventory[INVEN_RARM]; break;
                case 2: o_ptr = &inventory[INVEN_LARM]; break;
@@ -5247,7 +5247,7 @@ bool curse_armor(void)
        object_desc(o_name, o_ptr, FALSE, 3);
 
        /* Attempt a saving throw for artifacts */
-       if ((o_ptr->art_name || artifact_p(o_ptr)) && (rand_int(100) < 50))
+       if ((o_ptr->art_name || artifact_p(o_ptr)) && (randint0(100) < 50))
        {
                /* Cool */
 #ifdef JP
@@ -5275,7 +5275,7 @@ msg_format("
                /* Blast the armor */
                o_ptr->name1 = 0;
                o_ptr->name2 = EGO_BLASTED;
-               o_ptr->to_a = 0 - randint(5) - randint(5);
+               o_ptr->to_a = 0 - randint1(5) - randint1(5);
                o_ptr->to_h = 0;
                o_ptr->to_d = 0;
                o_ptr->ac = 0;
@@ -5326,7 +5326,7 @@ bool curse_weapon(bool force, int slot)
        object_desc(o_name, o_ptr, FALSE, 3);
 
        /* Attempt a saving throw */
-       if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 50) && !force)
+       if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 50) && !force)
        {
                /* Cool */
 #ifdef JP
@@ -5354,8 +5354,8 @@ if (!force) msg_format("
                /* Shatter the weapon */
                o_ptr->name1 = 0;
                o_ptr->name2 = EGO_SHATTERED;
-               o_ptr->to_h = 0 - randint(5) - randint(5);
-               o_ptr->to_d = 0 - randint(5) - randint(5);
+               o_ptr->to_h = 0 - randint1(5) - randint1(5);
+               o_ptr->to_d = 0 - randint1(5) - randint1(5);
                o_ptr->to_a = 0;
                o_ptr->ac = 0;
                o_ptr->dd = 0;
@@ -5409,7 +5409,7 @@ bool brand_bolts(void)
                if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
 
                /* Randomize */
-               if (rand_int(100) < 75) continue;
+               if (randint0(100) < 75) continue;
 
                /* Message */
 #ifdef JP
@@ -5423,7 +5423,7 @@ msg_print("
                o_ptr->name2 = EGO_FLAME;
 
                /* Enchant */
-               enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+               enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
 
                /* Notice */
                return (TRUE);
@@ -5462,8 +5462,8 @@ static s16b poly_r_idx(int r_idx)
                return (r_idx);
 
        /* Allowable range of "levels" for resulting monster */
-       lev1 = r_ptr->level - ((randint(20) / randint(9)) + 1);
-       lev2 = r_ptr->level + ((randint(20) / randint(9)) + 1);
+       lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
+       lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
 
        /* Pick a (possibly new) non-unique race */
        for (i = 0; i < 1000; i++)
@@ -5556,7 +5556,7 @@ bool dimension_door(void)
 
        if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
                (distance(y, x, py, px) > plev / 2 + 10) ||
-               (!rand_int(plev / 10 + 10)))
+               (!randint0(plev / 10 + 10)))
        {
          if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
 #ifdef JP
index fd492cb..cf03b4d 100644 (file)
@@ -309,13 +309,13 @@ static void say_comment_1(void)
 #ifdef JP
         /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î¤È¤­¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
         if ( cur_store_num == STORE_BLACK ) {
-                msg_print(comment_1_B[rand_int(MAX_COMMENT_1)]);
+                msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
         }
         else{
-                msg_print(comment_1[rand_int(MAX_COMMENT_1)]);
+                msg_print(comment_1[randint0(MAX_COMMENT_1)]);
         }
 #else
-       msg_print(comment_1[rand_int(MAX_COMMENT_1)]);
+       msg_print(comment_1[randint0(MAX_COMMENT_1)]);
 #endif
 
 
@@ -353,7 +353,7 @@ static void say_comment_2(s32b value, int annoyed)
        if (annoyed > 0)
        {
                /* Formatted message */
-               msg_format(comment_2a[rand_int(MAX_COMMENT_2A)], tmp_val);
+               msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
        }
 
        /* Normal offer */
@@ -363,13 +363,13 @@ static void say_comment_2(s32b value, int annoyed)
 #ifdef JP
                /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
                if ( cur_store_num == STORE_BLACK ){
-                       msg_format(comment_2b_B[rand_int(MAX_COMMENT_2B)], tmp_val);
+                       msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
                }
                else{
-               msg_format(comment_2b[rand_int(MAX_COMMENT_2B)], tmp_val);
+               msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
        }
 #else
-               msg_format(comment_2b[rand_int(MAX_COMMENT_2B)], tmp_val);
+               msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
 #endif
 
        }
@@ -390,7 +390,7 @@ static void say_comment_3(s32b value, int annoyed)
        if (annoyed > 0)
        {
                /* Formatted message */
-               msg_format(comment_3a[rand_int(MAX_COMMENT_3A)], tmp_val);
+               msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
        }
 
        /* Normal offer */
@@ -400,13 +400,13 @@ static void say_comment_3(s32b value, int annoyed)
 #ifdef JP
                /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
                if ( cur_store_num == STORE_BLACK ){
-                       msg_format(comment_3b_B[rand_int(MAX_COMMENT_3B)], tmp_val);
+                       msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
                }
                else{
-               msg_format(comment_3b[rand_int(MAX_COMMENT_3B)], tmp_val);
+               msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
        }
 #else
-               msg_format(comment_3b[rand_int(MAX_COMMENT_3B)], tmp_val);
+               msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
 #endif
 
        }
@@ -421,16 +421,16 @@ static void say_comment_4(void)
 #ifdef JP
         /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
         if ( cur_store_num == STORE_BLACK ){
-                msg_print(comment_4a_B[rand_int(MAX_COMMENT_4A)]);
-                msg_print(comment_4b_B[rand_int(MAX_COMMENT_4B)]);
+                msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
+                msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
         }
         else{
-                msg_print(comment_4a[rand_int(MAX_COMMENT_4A)]);
-                msg_print(comment_4b[rand_int(MAX_COMMENT_4B)]);
+                msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
+                msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
         }
 #else
-       msg_print(comment_4a[rand_int(MAX_COMMENT_4A)]);
-       msg_print(comment_4b[rand_int(MAX_COMMENT_4B)]);
+       msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
+       msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
 #endif
 
 }
@@ -444,13 +444,13 @@ static void say_comment_5(void)
 #ifdef JP
         /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
         if ( cur_store_num == STORE_BLACK ){
-                msg_print(comment_5_B[rand_int(MAX_COMMENT_5)]);
+                msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
         }
         else{
-                msg_print(comment_5[rand_int(MAX_COMMENT_5)]);
+                msg_print(comment_5[randint0(MAX_COMMENT_5)]);
         }
 #else
-       msg_print(comment_5[rand_int(MAX_COMMENT_5)]);
+       msg_print(comment_5[randint0(MAX_COMMENT_5)]);
 #endif
 
 }
@@ -461,7 +461,7 @@ static void say_comment_5(void)
  */
 static void say_comment_6(void)
 {
-       msg_print(comment_6[rand_int(MAX_COMMENT_6)]);
+       msg_print(comment_6[randint0(MAX_COMMENT_6)]);
 }
 
 
@@ -554,7 +554,7 @@ static void purchase_analyze(s32b price, s32b value, s32b guess)
        if ((value <= 0) && (price > value))
        {
                /* Comment */
-               msg_print(comment_7a[rand_int(MAX_COMMENT_7A)]);
+               msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
 
                chg_virtue(V_HONOUR, -1);
                chg_virtue(V_JUSTICE, -1);
@@ -567,7 +567,7 @@ static void purchase_analyze(s32b price, s32b value, s32b guess)
        else if ((value < guess) && (price > value))
        {
                /* Comment */
-               msg_print(comment_7b[rand_int(MAX_COMMENT_7B)]);
+               msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
 
                chg_virtue(V_JUSTICE, -1);
                if (one_in_(4))
@@ -581,7 +581,7 @@ static void purchase_analyze(s32b price, s32b value, s32b guess)
        else if ((value > guess) && (value < (4 * guess)) && (price < value))
        {
                /* Comment */
-               msg_print(comment_7c[rand_int(MAX_COMMENT_7C)]);
+               msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
 
                if (one_in_(4))
                        chg_virtue(V_HONOUR, -1);
@@ -596,7 +596,7 @@ static void purchase_analyze(s32b price, s32b value, s32b guess)
        else if ((value > guess) && (price < value))
        {
                /* Comment */
-               msg_print(comment_7d[rand_int(MAX_COMMENT_7D)]);
+               msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
 
                if (one_in_(2))
                        chg_virtue(V_HONOUR, -1);
@@ -1824,16 +1824,16 @@ static void store_delete(void)
        int what, num;
 
        /* Pick a random slot */
-       what = rand_int(st_ptr->stock_num);
+       what = randint0(st_ptr->stock_num);
 
        /* Determine how many items are here */
        num = st_ptr->stock[what].number;
 
        /* Hack -- sometimes, only destroy half the items */
-       if (rand_int(100) < 50) num = (num + 1) / 2;
+       if (randint0(100) < 50) num = (num + 1) / 2;
 
        /* Hack -- sometimes, only destroy a single item */
-       if (rand_int(100) < 50) num = 1;
+       if (randint0(100) < 50) num = 1;
 
        /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
        if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
@@ -1877,7 +1877,7 @@ static void store_create(void)
                if (cur_store_num == STORE_BLACK)
                {
                        /* Pick a level for object/magic */
-                       level = 25 + rand_int(25);
+                       level = 25 + randint0(25);
 
                        /* Random item (usually of given level) */
                        i = get_obj_num(level);
@@ -1890,7 +1890,7 @@ static void store_create(void)
                else
                {
                        /* Hack -- Pick an item to sell */
-                       i = st_ptr->table[rand_int(st_ptr->table_num)];
+                       i = st_ptr->table[randint0(st_ptr->table_num)];
 
                        /* Hack -- fake level for apply_magic() */
                        level = rand_range(1, STORE_OBJ_LEVEL);
@@ -2452,7 +2452,7 @@ static int increase_insults(void)
                st_ptr->bad_buy = 0;
 
                /* Open tomorrow */
-               st_ptr->store_open = turn + 25000 + randint(25000);
+               st_ptr->store_open = turn + 25000 + randint1(25000);
 
                /* Closed */
                return (TRUE);
@@ -4805,7 +4805,7 @@ void store_shuffle(int which)
        /* Pick a new owner */
        while(1)
        {
-               st_ptr->owner = (byte)rand_int(MAX_OWNERS);
+               st_ptr->owner = (byte)randint0(MAX_OWNERS);
                if (j == st_ptr->owner) continue;
                for (i = 1;i < max_towns; i++)
                {
@@ -4899,7 +4899,7 @@ void store_maint(int town_num, int store_num)
        j = st_ptr->stock_num;
 
        /* Sell a few items */
-       j = j - randint(STORE_TURNOVER);
+       j = j - randint1(STORE_TURNOVER);
 
        /* Never keep more than "STORE_MAX_KEEP" slots */
        if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
@@ -4918,7 +4918,7 @@ void store_maint(int town_num, int store_num)
        j = st_ptr->stock_num;
 
        /* Buy some more items */
-       j = j + randint(STORE_TURNOVER);
+       j = j + randint1(STORE_TURNOVER);
 
        /* Never keep more than "STORE_MAX_KEEP" slots */
        if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
@@ -4956,7 +4956,7 @@ void store_init(int town_num, int store_num)
        {
                int i;
 
-               st_ptr->owner = (byte)rand_int(MAX_OWNERS);
+               st_ptr->owner = (byte)randint0(MAX_OWNERS);
                for (i = 1;i < max_towns; i++)
                {
                        if (i == town_num) continue;
index e7da296..2218dda 100644 (file)
@@ -44,7 +44,7 @@ static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2
                if (dy != 0)
                {
                        /* perturbation perpendicular to path */
-                       changex = randint(abs(dy)) * 2 - abs(dy);
+                       changex = randint1(abs(dy)) * 2 - abs(dy);
                }
                else
                {
@@ -54,7 +54,7 @@ static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2
                if (dx != 0)
                {
                        /* perturbation perpendicular to path */
-                       changey = randint(abs(dx)) * 2 - abs(dx);
+                       changey = randint1(abs(dx)) * 2 - abs(dx);
                }
                else
                {
@@ -145,16 +145,16 @@ void add_river(int feat1, int feat2)
 
 
        /* Hack -- Choose starting point */
-       y2 = randint(cur_hgt / 2 - 2) + cur_hgt / 2;
-       x2 = randint(cur_wid / 2 - 2) + cur_wid / 2;
+       y2 = randint1(cur_hgt / 2 - 2) + cur_hgt / 2;
+       x2 = randint1(cur_wid / 2 - 2) + cur_wid / 2;
 
        /* Hack -- Choose ending point somewhere on boundary */
-       switch(randint(4))
+       switch(randint1(4))
        {
                case 1:
                {
                        /* top boundary */
-                       x1 = randint(cur_wid-2)+1;
+                       x1 = randint1(cur_wid-2)+1;
                        y1 = 1;
                        break;
                }
@@ -162,26 +162,26 @@ void add_river(int feat1, int feat2)
                {
                        /* left boundary */
                        x1 = 1;
-                       y1 = randint(cur_hgt-2)+1;
+                       y1 = randint1(cur_hgt-2)+1;
                        break;
                }
                case 3:
                {
                        /* right boundary */
                        x1 = cur_wid-1;
-                       y1 = randint(cur_hgt-2)+1;
+                       y1 = randint1(cur_hgt-2)+1;
                        break;
                }
                case 4:
                {
                        /* bottom boundary */
-                       x1 = randint(cur_wid-2)+1;
+                       x1 = randint1(cur_wid-2)+1;
                        y1 = cur_hgt-1;
                        break;
                }
        }
 
-       wid = randint(DUN_WAT_RNG);
+       wid = randint1(DUN_WAT_RNG);
        recursive_river(x1, y1, x2, y2, feat1, feat2, wid);
 
        /* Hack - Save the location as a "room" */
@@ -216,7 +216,7 @@ void build_streamer(int feat, int chance)
        x = rand_spread(cur_wid / 2, 15);
 
        /* Choose a random compass direction */
-       dir = ddd[rand_int(8)];
+       dir = ddd[randint0(8)];
 
        /* Place streamer into dungeon */
        while (dummy < SAFE_MAX_ATTEMPTS)
@@ -315,9 +315,9 @@ void place_trees(int x, int y)
                                 * Clear previous contents, add feature
                                 * The border mainly gets trees, while the center gets rubble
                                 */
-                               if ((distance(j, i, y, x) > 1) || (randint(100) < 25))
+                               if ((distance(j, i, y, x) > 1) || (randint1(100) < 25))
                                {
-                                       if (randint(100) < 75)
+                                       if (randint1(100) < 75)
                                                cave[j][i].feat = FEAT_TREES;
                                }
                                else
@@ -358,7 +358,7 @@ if (cheat_room) msg_print("
 
 
        /* Drop a few epi-centers (usually about two) */
-       for (n = 0; n < randint(5); n++)
+       for (n = 0; n < randint1(5); n++)
        {
                /* Pick an epi-center */
                x1 = rand_range(5, cur_wid - 1 - 5);
@@ -391,7 +391,7 @@ if (cheat_room) msg_print("
                                        delete_object(y, x);
 
                                        /* Wall (or floor) type */
-                                       t = rand_int(200);
+                                       t = randint0(200);
 
                                        /* Granite */
                                        if (t < 20)
index 6afad35..0271a58 100644 (file)
@@ -25,7 +25,7 @@ static void perturb_point_mid(int x1, int x2, int x3, int x4,
         * tmp is a random int +/- rough
         */
        int tmp2 = rough*2 + 1;
-       int tmp = randint(tmp2) - (rough + 1);
+       int tmp = randint1(tmp2) - (rough + 1);
 
        int avg = ((x1 + x2 + x3 + x4) / 4) + tmp;
 
@@ -50,7 +50,7 @@ static void perturb_point_end(int x1, int x2, int x3,
         * tmp is a random int +/- rough
         */
        int tmp2 = rough * 2 + 1;
-       int tmp = rand_int(tmp2) - rough;
+       int tmp = randint0(tmp2) - rough;
 
        int avg = ((x1 + x2 + x3) / 3) + tmp;
 
@@ -474,10 +474,10 @@ void generate_wilderness_area(int terrain, u32b seed, bool border, bool corner)
         * ToDo: calculate the medium height of the adjacent
         * terrains for every corner.
         */
-       cave[1][1].feat = (byte)rand_int(table_size);
-       cave[MAX_HGT-2][1].feat = (byte)rand_int(table_size);
-       cave[1][MAX_WID-2].feat = (byte)rand_int(table_size);
-       cave[MAX_HGT-2][MAX_WID-2].feat = (byte)rand_int(table_size);
+       cave[1][1].feat = (byte)randint0(table_size);
+       cave[MAX_HGT-2][1].feat = (byte)randint0(table_size);
+       cave[1][MAX_WID-2].feat = (byte)randint0(table_size);
+       cave[MAX_HGT-2][MAX_WID-2].feat = (byte)randint0(table_size);
 
        if (!corner)
        {
@@ -1098,7 +1098,7 @@ void seed_wilderness(void)
        {
                for (y = 0; y < max_wild_y; y++)
                {
-                       wilderness[y][x].seed = rand_int(0x10000000);
+                       wilderness[y][x].seed = randint0(0x10000000);
                        wilderness[y][x].entrance = 0;
                }
        }
index 3b9804d..bf1a9c9 100644 (file)
@@ -33,14 +33,14 @@ void do_cmd_rerate(bool display)
 
                for (i = 1; i < 4; i++)
                {
-                       j = randint(p_ptr->hitdie);
+                       j = randint1(p_ptr->hitdie);
                        player_hp[0] += j;
                }
 
                /* Collect values */
                for (i = 1; i < PY_MAX_LEVEL; i++)
                {
-                       player_hp[i] = randint(p_ptr->hitdie);
+                       player_hp[i] = randint1(p_ptr->hitdie);
                        player_hp[i] += player_hp[i - 1];
                }
 
index 5706110..4d0c753 100644 (file)
@@ -195,7 +195,7 @@ msg_format("
                                screen_load();
                        }
                        else if(!(p_ptr->max_plv % 2))
-                               do_inc_stat(rand_int(6));
+                               do_inc_stat(randint0(6));
                }
 
                if (level_mutation)
@@ -931,7 +931,7 @@ msg_print("
        /* Bloodletters of Khorne may drop a blade of chaos */
        else if (m_ptr->r_idx == MON_BLOODLETTER &&
 
-                (randint(100) < 15) &&
+                (randint1(100) < 15) &&
            !(p_ptr->inside_arena || p_ptr->inside_battle))
        {
                /* Get local object */
@@ -979,7 +979,7 @@ msg_print("
                q_ptr = &forge;
 
                /* Prepare to make a Blade of Chaos */
-               object_prep(q_ptr, lookup_kind(TV_SWORD, randint(2)));
+               object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
 
                /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
@@ -1323,7 +1323,7 @@ msg_print("
                                chance = 5;
                        }
 
-                       if ((a_idx > 0) && ((randint(99) < chance) || (wizard)))
+                       if ((a_idx > 0) && ((randint1(99) < chance) || (wizard)))
                        {
                                if (a_info[a_idx].cur_num == 0)
                                {
@@ -1376,8 +1376,8 @@ msg_print("
        }
 
        /* Determine how much we can drop */
-       if ((r_ptr->flags1 & RF1_DROP_60) && (rand_int(100) < 60)) number++;
-       if ((r_ptr->flags1 & RF1_DROP_90) && (rand_int(100) < 90)) number++;
+       if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
+       if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
        if  (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
        if  (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
        if  (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
@@ -1406,7 +1406,7 @@ msg_print("
                object_wipe(q_ptr);
 
                /* Make Gold */
-               if (do_gold && (!do_item || (rand_int(100) < 50)))
+               if (do_gold && (!do_item || (randint0(100) < 50)))
                {
                        /* Make some gold */
                        if (!make_gold(q_ptr)) continue;
@@ -1723,7 +1723,7 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
                /* Don't kill Amberites */
                if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
                {
-                       int curses = 1 + randint(3);
+                       int curses = 1 + randint1(3);
                        bool stop_ty = FALSE;
                        int count = 0;
 
@@ -1772,7 +1772,7 @@ msg_format("%^s
                        }
                        else if (r_ptr->level > dun_level)
                        {
-                               if (randint(10) <= (r_ptr->level - dun_level))
+                               if (randint1(10) <= (r_ptr->level - dun_level))
                                        chg_virtue(V_VALOUR, 1);
                        }
                        if (r_ptr->level > 60)
@@ -1803,7 +1803,7 @@ msg_format("%^s
                }
 
                if ((r_ptr->flags3 & RF3_GOOD) &&
-                       ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100)))
+                       ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
                        
                        chg_virtue(V_UNLIFE, 1);
 
@@ -1811,7 +1811,7 @@ msg_format("%^s
                {
                        if (r_ptr->flags1 & RF1_UNIQUE)
                                chg_virtue(V_FAITH, -2);
-                       else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+                       else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
                        {
                                if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
                                else chg_virtue(V_FAITH, 1);
@@ -1821,7 +1821,7 @@ msg_format("%^s
                {
                        if (r_ptr->flags1 & RF1_UNIQUE)
                                chg_virtue(V_FAITH, 2);
-                       else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+                       else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
                                chg_virtue(V_FAITH, 1);
                }
 
@@ -1834,7 +1834,7 @@ msg_format("%^s
                        {
                                chg_virtue(V_HONOUR, 10);
                        }
-                       else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint(100))
+                       else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
                        {
                                chg_virtue(V_HONOUR, 1);
                        }
@@ -1862,7 +1862,7 @@ msg_format("%^s
                        if (r_ptr->flags1 & RF1_UNIQUE)
                                chg_virtue(V_JUSTICE, 3);
                        else if (1+((r_ptr->level) / 10 + (2 * dun_level))
-                               >= randint(100))
+                               >= randint1(100))
                                
                                chg_virtue(V_JUSTICE, 1);
                }
@@ -2057,7 +2057,7 @@ msg_format("%s
        /* Mega-Hack -- Pain cancels fear */
        if (m_ptr->monfear && (dam > 0))
        {
-               int tmp = randint(dam);
+               int tmp = randint1(dam);
 
                /* Cure a little fear */
                if (tmp < m_ptr->monfear)
@@ -2089,14 +2089,14 @@ msg_format("%s
                 * Run (sometimes) if at 10% or less of max hit points,
                 * or (usually) when hit for half its current hit points
                 */
-               if (((percentage <= 10) && (rand_int(10) < percentage)) ||
-                   ((dam >= m_ptr->hp) && (rand_int(100) < 80)))
+               if (((percentage <= 10) && (randint0(10) < percentage)) ||
+                   ((dam >= m_ptr->hp) && (randint0(100) < 80)))
                {
                        /* Hack -- note fear */
                        (*fear) = TRUE;
 
                        /* XXX XXX XXX Hack -- Add some timed fear */
-                       m_ptr->monfear = (randint(10) +
+                       m_ptr->monfear = (randint1(10) +
                                          (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                           20 : ((11 - percentage) * 5)));
                }
@@ -4121,7 +4121,7 @@ p = "
        {
                /* XXX XXX XXX */
                /* Random direction */
-               dir = ddd[rand_int(8)];
+               dir = ddd[randint0(8)];
        }
 
        /* Notice confusion */
@@ -4221,10 +4221,10 @@ if (!get_com("
        if (p_ptr->confused)
        {
                /* Standard confusion */
-               if (rand_int(100) < 75)
+               if (randint0(100) < 75)
                {
                        /* Random direction */
-                       dir = ddd[rand_int(8)];
+                       dir = ddd[randint0(8)];
                }
        }
        else if (p_ptr->riding)
@@ -4235,21 +4235,21 @@ if (!get_com("
                if (m_ptr->confused)
                {
                        /* Standard confusion */
-                       if (rand_int(100) < 75)
+                       if (randint0(100) < 75)
                        {
                                /* Random direction */
-                               dir = ddd[rand_int(8)];
+                               dir = ddd[randint0(8)];
                        }
                }
-               else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (rand_int(100) < 50))
+               else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
                {
                        /* Random direction */
-                       dir = ddd[rand_int(8)];
+                       dir = ddd[randint0(8)];
                }
-               else if ((r_ptr->flags1 & RF1_RAND_50) && (rand_int(100) < 25))
+               else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
                {
                        /* Random direction */
-                       dir = ddd[rand_int(8)];
+                       dir = ddd[randint0(8)];
                }
        }
 
@@ -4359,10 +4359,10 @@ if (!get_com("
        if (p_ptr->confused)
        {
                /* Standard confusion */
-               if (rand_int(100) < 75)
+               if (randint0(100) < 75)
                {
                        /* Random direction */
-                       dir = ddd[rand_int(8)];
+                       dir = ddd[randint0(8)];
                }
        }
 
@@ -4424,9 +4424,9 @@ void gain_level_reward(int chosen_reward)
        else if (!(p_ptr->lev % 14)) nasty_chance = 12;
 
        if (one_in_(nasty_chance))
-               type = randint(20); /* Allow the 'nasty' effects */
+               type = randint1(20); /* Allow the 'nasty' effects */
        else
-               type = randint(15) + 5; /* Or disallow them */
+               type = randint1(15) + 5; /* Or disallow them */
 
        if (type < 1) type = 1;
        if (type > 20) type = 20;
@@ -4623,7 +4623,7 @@ msg_print("
                        /* Get local object */
                        q_ptr = &forge;
                        dummy = TV_SWORD;
-                       switch (randint(p_ptr->lev))
+                       switch (randint1(p_ptr->lev))
                        {
                                case 0: case 1:
                                        dummy2 = SV_DAGGER;
@@ -4711,9 +4711,9 @@ msg_print("
                        }
 
                        object_prep(q_ptr, lookup_kind(dummy, dummy2));
-                       q_ptr->to_h = 3 + randint(dun_level) % 10;
-                       q_ptr->to_d = 3 + randint(dun_level) % 10;
-                       random_resistance(q_ptr, FALSE, randint(34) + 4);
+                       q_ptr->to_h = 3 + randint1(dun_level) % 10;
+                       q_ptr->to_d = 3 + randint1(dun_level) % 10;
+                       random_resistance(q_ptr, FALSE, randint1(34) + 4);
                        q_ptr->name2 = EGO_CHAOTIC;
 
                        /* Drop it in the dungeon */
@@ -4739,7 +4739,7 @@ msg_print("
                        msg_print("'Thy deed hath earned thee a worthy reward.'");
 #endif
 
-                       acquirement(py, px, randint(2) + 1, FALSE, FALSE);
+                       acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
 #ifdef JP
                        reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -4761,7 +4761,7 @@ msg_print("
                        msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
 #endif
 
-                       acquirement(py, px, randint(2) + 1, TRUE, FALSE);
+                       acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
 #ifdef JP
                        reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -4805,7 +4805,7 @@ msg_print("
                        msg_print("'My pets, destroy the arrogant mortal!'");
 #endif
 
-                       for (dummy = 0; dummy < randint(5) + 1; dummy++)
+                       for (dummy = 0; dummy < randint1(5) + 1; dummy++)
                        {
                                (void)summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
                        }
@@ -4877,7 +4877,7 @@ msg_print("
                        if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
                                do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
                        else
-                               do_inc_stat(rand_int(6));
+                               do_inc_stat(randint0(6));
 #ifdef JP
                        reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
 #else
@@ -4902,7 +4902,7 @@ msg_print("
                        if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
                                do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
                        else
-                               (void)do_dec_stat(rand_int(6));
+                               (void)do_dec_stat(randint0(6));
 #ifdef JP
                        reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
 #else
@@ -4928,7 +4928,7 @@ msg_print("
 
                        for (dummy = 0; dummy < 6; dummy++)
                        {
-                               (void)dec_stat(dummy, 10 + randint(15), TRUE);
+                               (void)dec_stat(dummy, 10 + randint1(15), TRUE);
                        }
 #ifdef JP
                        reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
@@ -5095,7 +5095,7 @@ msg_print("
                        msg_print("'Now thou shalt pay for annoying me.'");
 #endif
 
-                       switch (randint(4))
+                       switch (randint1(4))
                        {
                                case 1:
                                        (void)activate_ty_curse(FALSE, &count);
@@ -5140,7 +5140,7 @@ msg_print("
                                default:
                                        for (dummy = 0; dummy < 6; dummy++)
                                        {
-                                               (void)dec_stat(dummy, 10 + randint(15), TRUE);
+                                               (void)dec_stat(dummy, 10 + randint1(15), TRUE);
                                        }
 #ifdef JP
                                        reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
@@ -5167,7 +5167,7 @@ msg_print("
                        take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
                        for (dummy = 0; dummy < 6; dummy++)
                        {
-                               (void)dec_stat(dummy, 10 + randint(15), FALSE);
+                               (void)dec_stat(dummy, 10 + randint1(15), FALSE);
                        }
                        activate_hi_summon(py, px, FALSE);
                        (void)activate_ty_curse(FALSE, &count);
@@ -5570,7 +5570,7 @@ p = "
        {
                /* XXX XXX XXX */
                /* Random direction */
-               dir = ddd[rand_int(8)];
+               dir = ddd[randint0(8)];
        }
 
        /* Notice confusion */
@@ -5605,7 +5605,7 @@ s16b gain_energy(void)
        s32b energy_result = 10;
        s32b tmp;
 
-       tmp = rand_int(Go_no_JuuJou);
+       tmp = randint0(Go_no_JuuJou);
 
        for (i = 0; i < 9; i ++){
                energy_result += tmp % 5;
index 34f9e4a..8e4bf96 100644 (file)
@@ -24,7 +24,7 @@
  * and is much less subject to low-bit-non-randomness problems.
  *
  * You can select your favorite flavor by proper definition of the
- * "rand_int()" macro in the "defines.h" file.
+ * "randint0()" macro in the "defines.h" file.
  *
  * Note that, in Angband 2.8.0, the "state" table will be saved in the
  * savefile, so a special "initialization" phase will be necessary.
@@ -298,7 +298,7 @@ s16b randnor(int mean, int stand)
        if (stand < 1) return (mean);
 
        /* Roll for probability */
-       tmp = (s16b)rand_int(32768);
+       tmp = (s16b)randint0(32768);
 
        /* Binary Search */
        while (low < high)
@@ -322,7 +322,7 @@ s16b randnor(int mean, int stand)
        offset = (long)stand * (long)low / RANDNOR_STD;
 
        /* One half should be negative */
-       if (rand_int(100) < 50) return (mean - offset);
+       if (randint0(100) < 50) return (mean - offset);
 
        /* One half should be positive */
        return (mean + offset);
@@ -336,7 +336,7 @@ s16b randnor(int mean, int stand)
 s16b damroll(int num, int sides)
 {
        int i, sum = 0;
-       for (i = 0; i < num; i++) sum += randint(sides);
+       for (i = 0; i < num; i++) sum += randint1(sides);
        return (sum);
 }
 
index 637a65c..62ef525 100644 (file)
  * The integer X falls along a uniform distribution.
  * For example, if M is 100, you get "percentile dice"
  */
-#define rand_int(M) \
+#define randint0(M) \
        ((s32b)Rand_div(M))
 
 /*
  * Generates a random long integer X where A<=X<=B
  * The integer X falls along a uniform distribution.
- * Note: rand_range(0,N-1) == rand_int(N)
+ * Note: rand_range(0,N-1) == randint0(N)
  */
 #define rand_range(A,B) \
-       ((A) + (rand_int(1+(B)-(A))))
+       ((A) + (randint0(1+(B)-(A))))
 
 /*
  * Generate a random long integer X where A-D<=X<=A+D
  * Note: rand_spread(A,D) == rand_range(A-D,A+D)
  */
 #define rand_spread(A,D) \
-       ((A) + (rand_int(1+(D)+(D))) - (D))
+       ((A) + (randint0(1+(D)+(D))) - (D))
 
 
 /*
  * Generate a random long integer X where 1<=X<=M
  * Also, "correctly" handle the case of M<=1
  */
-#define randint(M) \
-       (rand_int(M) + 1)
+#define randint1(M) \
+       (randint0(M) + 1)
 
 
 /*
  * Evaluate to TRUE "P" percent of the time
  */
 #define magik(P) \
-       (rand_int(100) < (P))
+       (randint0(100) < (P))
 
 
 #define one_in_(X) \
-       (rand_int(X) == 0)
+       (randint0(X) == 0)
 
 /*
  * Evaluate to TRUE "S" percent of the time
  */
 #define saving_throw(S) \
-       (rand_int(100) < (S))
+       (randint0(100) < (S))
 
 
 /**** Available Variables ****/