This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Random no. problem


Hi!

I have a C program which uses the standard library random no. generator
rand() and srand() for initialisation. The program  gives consistent answer
when compiled using "gcc" on Sun Solaris or SGI Irix 6.4 .
When i run the code on Windows NT 4 using Cygnus gcc compiler , a different
set of random numbers are generated giving entirely different answer. 

Here is the  code:

#include <stdlib.h>
main(){

	srand(1);
	printf("%i",rand());

}
When compiled on Sun Solaris or SGI Irix 6.4 using gcc compier i get 16838.
When compiled on Windows NT 4 using Cygnus gcc compiler i get 1103527590.
Is there a way i can get the same random numbers on Windows NT 4 and
Sun/SGI ?
 
thanks,
Saurabh
 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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