Mail Archives: djgpp/1995/06/21/17:58:07
Carl DOT Johansson AT Helsinki DOT fi (Carl Johansson) writes:
>Does anyone know what the MAXINT statement in the explanation of the
>random() function is? Is it a variable, some kind of function
>parameter or something else, and how do you use it? (My version is
>1.12).
MAXINT is defined in values.h and is the maximum value you can
store in a variable of type integer. Your implementation of random()
probably returns a random number between 0 and MAXINT, this is so as
to allow the maximum resolution possible. Simply scale it to what
you want, eg divide it by (MAXINT/10) to get a number between 0 an 10.
I don't know about dgpp but most DOS compilers have MAXINT = 0x7fff
= 32767. Maybe because of the dpmi stuff you get a nice 32 bits so
MAXINT will be 2^31 appox = 2.147 billion. Anyway, it doesn't really
matter since you should just use MAXINT for portability.
HTH a little bit but I apologize for the hazy nature of the reply :)
Russell
--
Russell Edwards -- voodoo AT yoyo DOT cc DOT monash DOT edu DOT au -- IRC: VoodChile
Student of Computer Science and Electrical and Computer Systems Engineering
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-
Woohoo!! I mean 'DOH!'
- Raw text -