List Info

Thread: Re: random number generator--again!




Re: random number generator--again!
country flaguser name
United States
2007-08-30 00:58:53

Seth -

I'm wondering if there is a reason that the user's random number
generators share the same seed with the internal system's seeds. If
there were two sets of seeds users wouldn't need to say WITH-LOCAL-
RANDOMNESS (nor pay the tiny runtime overhead).

Best,

-ken

--- In netlogo-users%40yahoogroups.com">netlogo-usersyahoogroups.com, Seth Tisue <seth...> wrote:
&gt;
> >>&gt;>> "suwailems" == suwailems < no_reply%40yahoogroups.com">no_replyyahoogroups.com> writes:
>
> suwailems&gt; It seems that the generator is sensitive to the number
of
&gt; suwailems&gt; operations performed, even if they have nothing to do
with
> suwailems&gt; the generator.
>
> In NetLogo 3.1 and all later versions, all operations on agentsets
are
&gt; in random order. So even if you just do:
>
> ask patches [ set y (x / 500) + 10 ]
>
> you're actually using the random number generator, since the
patches run
> in random order and that order is determined by the generator.
>
> You can specify a fixed order using SORT or SORT-BY, for example:
>
> foreach sort patches [ ask ? [ ... ] ]
>
> In general, though, there are so many places in NetLogo where the
random
> number generator is used that you may need more general ways of
> controlling the random state. So, in NetLogo 4.0beta3 we
introduced a
> new primitive called WITH-LOCAL-RANDOMNESS. It takes a block of
> commands. Before the commands are run, the state of the random
number
> generator is remembered, and after the commands run, that random
state
> is restored. So if you write:
&gt;
> cmd1
>; with-local-randomness [ cmd2 ]
> cmd3
>;
> then the same random state that exists after cmd1 runs is used to
run
&gt; cmd2 and then restored and reused for running cmd3.
&gt;
> In the block of commands, you're free to set the random seed if you
> want, to control what random state cmd2 executes under, if that
matters
> to you.
>;
> See also the entry for WITH-LOCAL-RANDOMNESS in the NetLogo
Dictionary.
>
> Hope this helps,
&gt;
> --
> Seth Tisue / http://tisue.net
> lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
&gt;

__._,_.___
.

__,_._,___
Re: Re: random number generator--again!
country flaguser name
United States
2007-08-30 08:13:51

>>&gt;>> "Ken&quot; == Ken Kahn < toontalk%40gmail.com">toontalkgmail.com> writes:

Ken> Seth - I'm wondering if there is a reason that the user's random
Ken> number generators share the same seed with the internal system's
Ken> seeds. If there were two sets of seeds users wouldn't need to say
Ken> WITH-LOCAL- RANDOMNESS (nor pay the tiny runtime overhead).

I'm sorry, I don't think I understand what you're suggesting. Can you
explain it more fully? In particular, I don't understand the
distinction you're making between the "user's" RNG and the "system's"
RNG. We don't have that distinction; there's a single global RNG.

--
Seth Tisue / http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )