[xslt] rand() .vs. random()
- From: Phil Shafer <phil juniper net>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: [xslt] rand() .vs. random()
- Date: Fri, 8 Oct 2010 11:07:34 -0400
The math:random() function ends up calling rand(), not random():
#if defined(HAVE_STDLIB_H) && defined(RAND_MAX)
/**
* exsltMathRandom:
*
* Implements the EXSLT - Math random() function:
* number math:random ()
*
* Returns a random number between 0 and 1 inclusive.
*/
static double
exsltMathRandom (void) {
double ret;
int num;
num = rand();
ret = (double)num / (double)RAND_MAX;
return(ret);
}
Is this choice driven by portability? Should we be using
random() instead, since rand() gives cyclical data? Or
should we use the PRNG from openssh, if available?
Thanks,
Phil
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]