www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/06/23:10:36

Xref: news2.mv.net comp.lang.c:66748 comp.os.msdos.djgpp:3522
From: watzka AT stat DOT uni-muenchen DOT de (Kurt Watzka)
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: Use of random
Date: 6 May 1996 18:20:37 GMT
Organization: Institut fuer Statistik der LMU Muenchen (Germany)
Lines: 22
Distribution: world
Message-ID: <4mlftl$gho@sparcserver.lrz-muenchen.de>
References: <4mikhp$pa5 AT frodo DOT smartlink DOT net> <5MAY199622172832 AT erich DOT triumf DOT ca>
Reply-To: watzka AT stat DOT uni-muenchen DOT de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

bennett AT erich DOT triumf DOT ca (P.Bennett) writes:

>Perhaps you have previously used a Borland or Microsoft compiler, where ints
>are 16 bits, and RAND_MAX is 32767.  I expect that DJGPP has 32 bit ints, so
>RAND_MAX will be 2,147,483,647. (or so)

This connection is common, but not necessary. RAND_MAX cannot be greater
than INT_MAX for obvious reasons, but there is no need for RAND_MAX being
close to INT_MAX.

>If you want to restrict the numbers to 16 bits, you will have to use short
>ints, rather than plain ints.

And, afaik, there is no guarantee that short int is a 16 bit integer
type, it is just a common implementation.


Kurt

-- 
| Kurt Watzka                             Phone : +49-89-2180-6254
| watzka AT stat DOT uni-muenchen DOT de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019