Re: [xml] EXSLT random() function
- From: Ralf Junker <ralfjunker gmx de>
- To: xml gnome org
- Subject: Re: [xml] EXSLT random() function
- Date: Wed, 20 Feb 2008 20:35:21 +0100
so apparently libexslt implementation might just be conformant, but
as usual we takes patches ... But I don't see how you would seed in
a truely random fashion while keeping the code portable.
replying to myself, maybe we could just use
srand((unsigned int)time(NULL))
just before xsltRegisterExtModuleFunction ((const xmlChar *) "random", ...
in exsltMathRegister()
Well possible, but calling srand() automatically can be disturbing - and hard to debug, if not known! - if a
special srand() was issued previously to run reproducable tests.
Also, as far as I understand, calling srand() automatically is only required for external libxml libraries.
If linked into applications, they can just call srand() as they please.
How about, therefore, adding a simple srand() wrapper function like (for example xmlsrand() or similar) which
applications can call to set the external library's random seed?
Ralf
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]