On Wed, 2 Dec 1998, Keith Wansbrough wrote:
> Secondly, is it possible to specify at least some minimal conditions on the
> pseudorandom number generator? There are now some very good pseudorandom
> number generator algorithms[*], and it would be not unreasonable to require
> the generator to have say a minimum period, and maybe to pass some of Knuth's
> tests in The Art of Computer Programming volume n.
How are the (pseudo) random number generation functions in the Haskell
library implemented now -- are they programmed from scratch or implemented
by a call to other machine-native libraries? What I'm wondering is if
there's any reason why they couldn't allow the user to specify which
external function (given some standard interface) should be called by the
various Haskell primitives when compiling a program. (Efficiency,
reproducibilty of results when started with the same seed under (a)
multithreaded Haskell code & (b) general computational load are the only
problems I can conceive of.)
This was stimulated by Keith's suggestions on minimal conditions because
what is a good generator under certain usages/statistical tests can look
much worse under some other usages/statistical tests. Since this isn't a
function interface problem it seems more sensible for me to be able to
just change the implementation used rather than write my own IO monad
based wrapper. (This would have the advantage of quite possibly letting
the compiler writers, who are experts in functional compiler issues,
flexibly leverage off existing work by people whose expertise is in random
number generation rather than being forced to commit to a particular
implementation which is then forever hidden away `under the hood'.)
Of course, this is almost certainly an H2 suggestion, not H98.
___cheers,_dave_________________________________________________________
email: [EMAIL PROTECTED] "I'm guilty of a lot of things but I've
www.cs.bris.ac.uk/~tweed/pi.htm never violated the law of conservation
work tel: (0117) 954-5253 of energy!" -- Bart Kosko, Nanotime