MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Random replacement

  • To: mathgroup at
  • Subject: [mg50496] Random replacement
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Wed, 8 Sep 2004 05:11:57 -0400 (EDT)
  • Reply-to: Andrzej Kozlowski <akoz at>
  • Sender: owner-wri-mathgroup at

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:


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:   (in Japan)      (in Poland)

The name of the "package" is simply init.m.

Andrzej Kozlowski
Chiba, Japan

  • Prev by Date: Exact real numbers
  • Next by Date: Re: ColorFunctions again (making z=0 be different from z=1)
  • Previous by thread: Re: Exact real numbers
  • Next by thread: Re: Random replacement