swarm-support
[Top][All Lists]
Advanced

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

Re: Randon number generator


From: Benedikt Stefansson
Subject: Re: Randon number generator
Date: Wed, 05 Apr 2000 14:36:01 -0600

sabeeha wrote:

> hi,
> I have just started using swarm and i have this problem that i  used
> uniform distributions to generate random numbers(like in heatbugs), now i
> want to change the seed of my generator for different experiments. I have
> used the uniform distributions in many of my objects. for example this is
> the kind of code i have used:
>
>  k=[uniformIntRand getIntegerWithMin: 0 withMax: numAgents-1];
>
>  thankyou for your help
> -sabeeha

Assuming that you used the default uniformIntRand object (did not create an
instance of the UniformIntRand class explicitly in your code) you can simply
say:

[randomGenerator setSeed: YOURSEEDHERE];

Since the uniformIntRand instance is seeded from the RandomGenerator
instance (both are created when you call an initSwarm macro.)

See also the section on random number generation in this tutorial:

http://www.santafe.edu/projects/swarm/swarmfest99-tutorial/SectionThree-99/index.htm

Benedikt

--
Benedikt Stefansson      | address@hidden
CASA, Inc.               | Ph : (505) 988-8807 x101
Santa Fe, NM 87501       | Fax: (505) 988-3440




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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