On Fri, Oct 08, 2010 at 11:07:34AM -0400, Phil Shafer wrote:
> 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?
we had a thread about this earlier:
http://mail.gnome.org/archives/xml/2008-February/msg00092.html
what is crucially needed is an srand initialization there, I think
that's the most important point, but we could detect random() from
configure and plug it in too.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
[email protected] | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt