home *** CD-ROM | disk | FTP | other *** search
- /*
- * Blob random number routines
- */
-
- # include "BlobMgr.h"
-
-
- static pascal short
- DefaultRand (short max)
- {
- short t;
-
- t = Random ();
- if (t < 0) t = -t;
- return (t % (max + 1));
- }
-
-
- static BRandProcPtr bRandProc = (BRandProcPtr) DefaultRand;
-
-
- /*
- * Return integer between zero and max (inclusive). Assumes max is
- * non-negative.
- */
-
- pascal short
- BlobRand (short max)
- {
- return ((*bRandProc) (max));
- }
-
-
- /*
- * Install procedure as random number generator for BlobRand()
- */
-
- pascal void
- SetBlobRand (BRandProcPtr f)
- {
- bRandProc = (f == (BRandProcPtr) nil ? DefaultRand : f);
- }