Sender: |
|
Date: |
Sun, 25 Oct 2015 13:40:09 -0400 |
MIME-version: |
1.0 (Mac OS X Mail 7.3 \(1878.6\)) |
Reply-To: |
|
Content-type: |
text/plain; charset=windows-1250 |
Subject: |
|
From: |
|
In-Reply-To: |
|
Message-ID: |
|
Content-Transfer-Encoding: |
8bit |
Parts/Attachments: |
|
|
On Oct 25, 2015, at 3:39 AM, Ernesto Carrella <[log in to unmask]> wrote:
> It seems like using elements() to bag agents and then step them in a for loop is a recipe for artifacts: agents in the top left corner always act before agents in the bottom right.
Bag vals = grid.elements();
vals.shuffle(state.random);
And you're ready to go.
> I usually do what Russell does, keeping a reference to agents in a separate collection and stepping that, but I prefer an ArrayList to aBag; partially because of generics but mostly because I can call Collections.shuffle(agentList,random) and randomize their order before stepping them.
I would recommend strongly against using java.util.Random, and hence Collections.shuffle(...)
> The only caveat is that MersenneTwisterFast is not a kosher Random object so you can’t pass it directly, but you can just pass a seed from the MASON randomizer to a standard Java one (or extend the MASON one so that it fulfills Randominterface).
Again: it is unwise to use java.util.Random in a simulation.
Sean
|
|
|