home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:11702 comp.sys.amiga.programmer:11771
- Newsgroups: comp.lang.c,comp.sys.amiga.programmer
- Path: sparky!uunet!darwin.sura.net!gallux.gallaudet.edu!gallua!cads_cole
- From: CADS_COLE@GALLUA.BITNET (Kevin Cole; Washington DC)
- Subject: Matt Dillon's DICE (Amiga C) and rand() function
- Message-ID: <1992Jul29.081247.1@gallua>
- Lines: 32
- Sender: news@gallux.gallaudet.edu (News manager)
- Organization: Gallaudet Research Institute
- Date: Wed, 29 Jul 1992 13:12:47 GMT
-
- Date Sent: 29-Jul-1992 08:09:36
-
- Greetings from the void,
-
- Here's a very short C program that doesn't do what the documentation claims.
- According to Matt Dillon's DICE documents, I can limit the range of values
- returned by rand() if I define the variable RAND_MAX to something other than
- the default. I've tried various values, but I continue to get these huge
- (32-bit) numbers. Tell me I'm not missing something obvious.
-
- Thanx.
-
- #include <stdio.h>
- #include <stdlib.h>
- #define RAND_MAX ((1023))
- main()
- {
- int i;
- for (;;)
- {
- i = rand();
- printf("Random number %04X (%d)\n",i,i);
- }
- return(0);
- }
- --
-
- ========== U.S. Mail =============================== E-Mail =================
- Kevin Cole <Flatline> | Bitnet: CADS_COLE@GALLUA.BITNET
- Gallaudet Research Institute (GRI) | Internet: KJCOLE@GALLUX.GALLAUDET.EDU
- Washington, D.C. 20002-3625 | UUCP: ...!psuvax!gallua.bitnet!kjcole
- (202) 651-5575 x4592 | The WELL: kjcole
-