MathGroup Archive 2004

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

Search the Archive

Re: Re: Random replacement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50562] Re: [mg50523] Re: [mg50496] Random replacement
  • From: Andrzej Kozlowski <andrzej at akikoz.net>
  • Date: Fri, 10 Sep 2004 04:06:06 -0400 (EDT)
  • References: <200409090917.FAA19349@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is the way to test it. First evaluate

SeedRandom[5]

and

Random[]

0.368615

Now:

Unprotect[Random];

Clear[Random]

SeedRandom[5]

Random[]

0.786599

Note that I got a different answer than before. That means that the 
package did properly load and was working, before I cleared Random. Now 
to make it work again just quit the Kernel and restart it by performing 
another calculation.


Andrzej



Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/



On 8 Sep 2004, at 22:03, sean kim wrote:

> Hi andrej
>
> is there any tests to see whether or not I have put it
> in the proper folder and it is working as i wish?
>
> thanks in advance for any insights,
>
> sean
>
>
> --- Andrzej Kozlowski <andrzej at akikoz.net> wrote:
>
>> 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/
>>
>>
>
>
>
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>


  • Prev by Date: Re: parallel NMinimize[]
  • Next by Date: Re: Re: How to solve a simple Trig cofunction?
  • Previous by thread: Re: Random replacement
  • Next by thread: Re: Random replacement