/*
- * 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
/**** 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);