Random replacement
- To: mathgroup at smc.vnet.net
- Subject: [mg50496] Random replacement
- From: Andrzej Kozlowski <andrzej at akikoz.net>
- Date: Wed, 8 Sep 2004 05:11:57 -0400 (EDT)
- Reply-to: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Sender: owner-wri-mathgroup at wolfram.com
I have written a small "package" intended to as a workaround for the problem with the built in Random function fully explained by Daniel Lichtblau in: <http://library.wolfram.com/mathgroup/archive/2000/May/msg00088.html> The "package" simply implements Daniel's workaround described in his posting. In fact it is not a proper package (it defines no new contexts) but simply a init.m file which, if loaded on Kernel startup (this will happen if you put it into folder Kernel in the folder Autoload in your $UserAddOnsDirectory directory) will replace all calls to the SW algorithm that has been causing some problems by calls to Wolfram's "rule 30" CA automaton random number generator. (Actually it does not deal with large - more than 31 bit- integer calls). Of course, one can also copy the contents of the package and paste into an existing init.m file. The only advantage of this package, compared with very similar workarounds that have been mentioned several times on this list (which were based on defining a Random[] substitute called MyRandom or something like that) is that it does not require modifying the code for individual distributions in various statistics packages: by replacing Random itself we can deal with all the cases at once. The reason why I wrote this package was because I was obtaining inaccurate values for option pricing using Monte-Carlo simulation with the built in Random and the NormalDistribution package. With the replacement init.m file loaded these values have become noticeably better. I assume similar improvements should show up in programs that use simulation with a large number of samples with other distributions. The package can be downloaded from any of my two (identical) sites: http://www.akikoz.net/~andrzej//Mathematica/ (in Japan) http://www.mimuw.edu.pl/~akoz/Mathematica/ (in Poland) The name of the "package" is simply init.m. Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/