This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

rand() man-page ambiguous or bug in glibc?


Hi,

The man-page says:
	The rand() function returns a pseudo-random integer between 0
	and RAND_MAX.
"Between" says me that neither 0 or RAND_MAX should be returned but a
simple test-program tells me otherwise.

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){for(;;){long long int dummy=rand(); if
(dummy == 0 || dummy == RAND_MAX)printf("value is %d\n", dummy);} return
0;}

So what is it?


Folkert van Heusden

-- 
To MultiTail einai ena polymorfiko ergaleio gia ta logfiles kai tin
eksodo twn entolwn. Prosferei: filtrarisma, xrwmatismo, sygxwneysi,
diaforetikes provoles. http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]