OSDN Git Service

Rand_mod()は使われてないし、乱数発生器としての性能も悪くて今後も使わないはずなので削除。
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 22 Feb 2002 08:01:53 +0000 (08:01 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 22 Feb 2002 08:01:53 +0000 (08:01 +0000)
src/z-rand.c
src/z-rand.h

index 8e4bf96..f3c11de 100644 (file)
@@ -97,52 +97,6 @@ void Rand_state_init(u32b seed)
 
 
 /*
- * Extract a "random" number from 0 to m-1, via "modulus"
- *
- * Note that "m" should probably be less than 500000, or the
- * results may be rather biased towards low values.
- */
-s32b Rand_mod(s32b m)
-{
-       int j;
-       u32b r;
-
-       /* Hack -- simple case */
-       if (m <= 1) return (0);
-
-       /* Use the "simple" RNG */
-       if (Rand_quick)
-       {
-               /* Cycle the generator */
-               r = (Rand_value = LCRNG(Rand_value));
-
-               /* Mutate a 28-bit "random" number */
-               r = ((r >> 4) % m);
-       }
-
-       /* Use the "complex" RNG */
-       else
-       {
-               /* Acquire the next index */
-               j = Rand_place + 1;
-               if (j == RAND_DEG) j = 0;
-
-               /* Update the table, extract an entry */
-               r = (Rand_state[j] += Rand_state[Rand_place]);
-
-               /* Advance the index */
-               Rand_place = j;
-
-               /* Extract a "random" number */
-               r = ((r >> 4) % m);
-       }
-
-       /* Use the value */
-       return (r);
-}
-
-
-/*
  * Extract a "random" number from 0 to m-1, via "division"
  *
  * This method selects "random" 28-bit numbers, and then uses
index 62ef525..b5296b8 100644 (file)
@@ -83,7 +83,6 @@ extern u32b Rand_state[RAND_DEG];
 /**** Available Functions ****/
 
 extern void Rand_state_init(u32b seed);
-extern s32b Rand_mod(s32b m);
 extern s32b Rand_div(u32b m);
 extern s16b randnor(int mean, int stand);
 extern s16b damroll(int num, int sides);