[xslt] rand() .vs. random()



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]