Daniel Veillard wrote: [...]
Use the source, it's available !
static double
exsltMathRandom (void) {
double ret;
int num;
num = rand();
ret = (double)num / (double)RAND_MAX;
return(ret);
}
and man rand() states
--------------------
The rand() function returns a pseudo-random integer between 0 and
RAND_MAX.
The srand() function sets its argument as the seed for a new sequence
of pseudo-random integers to be returned by rand(). These sequences
are repeatable by calling srand() with the same seed value.
If no seed value is provided, the rand() function is automatically
seeded with a value of 1.
--------------------
Thank you for your informative reply. I actually know less than you think I do :-) I did look at the source, and the syntax and logic were clear enough, but I haven't worked in C, and it didn't occur to me that I could 'man rand' since it is in the standard library. It's all perfectly clear when you know the conventions, and now I've learned a bit. The concern about portability makes perfect sense, and if time() is portable, then the solution in your follow-up reply makes sense to me as well.
Thanks, Chuck -- Chuck Bearden (cbearden rice edu ; 713.348.3661) XML Engineer, Connexions http://cnx.org/