Cool about the Bag shuffle. Didn't know that. On Sun, Oct 25, 2015 at 5:40 PM Sean Luke <[log in to unmask]> wrote: > 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 >