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

On 2010-11-05 21:30:02 +0100, Daniel Veillard wrote:
> On Fri, Oct 08, 2010 at 11:07:34AM -0400, Phil Shafer wrote:
> > The math:random() function ends up calling rand(), not random():
>  we had a thread about this earlier:
> 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.

For some applications, reproducibility is important, so that the
default seed at the beginning must be the same. So, I'd say that
math:random is under-specified in the EXSLT spec (it should also
say whether 0 and 1 are inclusive or not). The description of
random:random-sequence is more clear. If you intend to implement
this one too, you may think about it, as random() would be
incorrect as not necessarily being thread-safe.

Vincent Lefèvre <vincent vinc17 net> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]