I am looking through a c program that is available for several OSs and produces inconsistent results among platforms for the exact same data. Looking because I lack some libraries to compile and debug it on my system.
I noticed that it calls rand() during initialization without calling srand(), probably because it needs only 1 random value. Now, I was wondering how does rand() behave in this case? Does it takes the operating system initial value of the random library ? I am currently hoping that this might explain the different results per platform, but I lack background knowledge to rand() and what happens if it is called without srand().
If it always returns an default-init value of the OS, it would explain why different platforms produces different results.
Thx for any input and sorry for the theoretic question - no code ^^.
Aucun commentaire:
Enregistrer un commentaire