[Package Index | Mudlib Index | Effect Index]
File /obj/handlers/random_num.c
Generate reproducible sequences of random numbers.
This is designed to produce a random number from the same
seed. This will make sequences of reproduceable random
numbers.
Useful for things like garbling of text and stuff so the garble
always looks the same...
Method index
- query_seed()
Returns the currently specified seed.
- random(int, mixed)
Generate a random number.
- set_seed(int)
Set the seed for the generator.
Public Functions
These are functions that everyone can access.
-
query_seed
int query_seed()
Returns the currently specified seed.
- Returns:
the current seed
-
random
varargs int random(int max,
mixed lseed)
Generate a random number. If lseed is an int, it is used as the seed.
If lseed is a one-element array of ints, lseed[0] is used as the seed
and the new seed is passed back. Otherwise, the previously set seed
is used.
- Parameters:
max - the maximum value for the number.
lseed - the seed to use, either an int or a one-element array
of int.
- Returns:
a number from 0..max-1 (inclusive)
-
set_seed
void set_seed(int new_seed)
Set the seed for the generator.
- Parameters:
new_seed - the seed to use.