home *** CD-ROM | disk | FTP | other *** search
- { -----------------------------------------------------------------------------
-
- NOTICE:
-
- THESE MATERIALS are UNSUPPORTED by OSS! If you do not understand how to
- use them do not contact OSS for help! We will not teach you how to
- program in Pascal. If you find an error in these materials, feel free
- to SEND US A LETTER explaining the error, and how to fix it.
-
- THE BOTTOM LINE:
-
- Use it, enjoy it, but you are on your own when using these materials!
-
-
- DISCLAIMER:
-
- OSS makes no representations or warranties with respect to the contents
- hereof and specifically disclaim all warranties of merchantability or
- fitness for any particular purpose. This document is subject to change
- without notice.
-
- OSS provides these materials for use with Personal Pascal. Use them in
- any way you wish.
-
- -------------------------------------------------------------------------- }
-
-
- {***************************************************************************
-
- Random number routines for Personal Pascal
-
- October 1, 1986 MJC
- Copyright 1986 OSS
-
- { Will not compile as-is! Include this file in your program... }
-
- *****************************************************************************}
-
-
- Function XB_Rnd : Long_Integer; { get xbios random 24-bit number }
- Xbios( 17 );
-
- (***************************************************************************
-
- Function Rnd returns a real number in the range of 0 to 1.
-
- ****************************************************************************)
-
- Function Rnd : Real;
-
- Begin
- Rnd := XB_Rnd / 16777216.0;
- End;
-
-
- (****************************************************************************
-
- Function Random takes a low and high range and returns a random
- integer that falls between Low and Hi.
-
- ****************************************************************************)
-
- Function Random( Low, Hi : Integer ) : Integer;
-
- Begin
- Random := Low + Trunc( Rnd * ( Hi - Low +1 ) );
- End;
-
- { END OF RANDOM.PAS }
-
-