prng/
This is a simple pseudo-random number generator class.  It uses the same rand()
algorithm printed in "The ANSI C Programming Language" by Kernighan & Ritchie,
which is a very good algorithm, with the main drawback being that it can only
really be used for 32-bit integers (as far as my skills go, anyway).  Luckily,
that's all most MUDs should need, and many already use the same algorithm.

The purpose for making this a class is so you can create instances as needed to
use specified seed values without compromising the state of the generator you
use for common things such as calculating damage or rolling dice.  This can be
accomplished either by simply using the PRNG class when a seed value is needed,
or by having a global instance of the PRNG class for most purposes, then
creating a new instance any time a seed value is needed.

There are two constructors.  The default constructor will seed the instance
with a call to time(), while providing an unsigned int argument will seed it
with the specified value.  There is also a public set_seed() method, should you
need to reset the seed of a specific instance.

The () operator has been overloaded with four sets of arguments so that an
object of the PRNG class may be called as though it were a function.  Up to a
total of three arguments may be specified, all of which are integers, with as
few as zero required.

With no arguments, a number between 1 and 100 will be generated.  With one
argument 'max', a number between 1 and 'max' will be generated. With two
arguments 'min' and 'max', a number between 'min' and 'max' will be generated.
With three arguments 'num', 'sides', and 'rolls', a dice roll will be
performed, with 'rolls' acting as an allowance for how many times die may be
re-rolled if they come up below 1/3rd of their maximum.

To use it, simply #include prng.h in your main header file or at the top of 
each file that will need random numbers, and add prng.cpp to your sourcecode,
whether that entails just sticking it in the src directory of your MUD or
adding it to the Makefile.

I've also included a sample program, prng_test.cpp as an example on how to use
the class as well as to demonstrate the algorithm in action in case that's
important to you.

To compile the test program:
  g++ prng.cpp prng_test.cpp -o prng

To run it:
  ./prng

The code included with this readme file has been released to the public domain
and as such may be used free of charge for any purpose.

 - Scott V. Fritz Jr., 8/31/2007