swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] Query regarding changing seed in a RNG


From: Paul Johnson
Subject: Re: [Swarm-Support] Query regarding changing seed in a RNG
Date: Fri, 14 Sep 2007 12:40:20 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070719)

Diego Corredor wrote:
Hi Steve,

I would like to know if there is a way to change the seed used by the
ListShuffler. I would like to be sure that the results observed in the
model that I have programmed are robust to the order of interaction
among consumers and firms.

Yes. Look in the swarm source code in ListShuffler.m. There is a creation method "setUniformRandom: " where you can tell the class to use a uniform distribution object if you want to create one. If you do not do so, it uses the built in uniform distribution, uniformUnsRand. That distribution object is created automatically for each swarm run, and it uses random numbers drawn from the built in randomGenerator object.

I know that's so because in the source code under src/random/random.m I find this line:

 uniformUnsRand  = [ UniformUnsignedDist create: globalZone
                        setGenerator: randomGenerator ];


That means if you want to control the seed used with List Shuffler, then you either must create your own generator and distribution pair and give that to the ListShuffler, or you must reset the seed on randomGenerator before you tell the ListShuffler to do anything.


[randomGenerator setStateFromSeed: xxx];


See what I mean?

HTH

pj



Thanks,

Diego Corredor



--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://pj.freefaculty.org
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

[Prev in Thread] Current Thread [Next in Thread]