random is an instance variable in your SimState subclass. If Java can't find random, this means that your code isn't part of the SimState; perhaps it's in an agent? If you passed the simstate in (as 'state') perhaps, you could say state.random.nextDouble()...
Also, you might not want getWidth() for both x and y, right?
> On Jul 12, 2020, at 1:28 PM, Annetta Burger <[log in to unmask]> wrote:
> I'm trying to position agents randomly into a GeomVectorField in MASON by setting the random coordinates. The swarm example with a continuous2D field is as follows:
> new Double2D(random.nextDouble()*width, random.nextDouble() * height));
> I think to get random coordinate from a GeomVectorField the code should look like:
> double xcoord = random.nextDouble() * world.censusTracts.getWidth();
> double ycoord = random.nextDouble() * world.censusTracts.getWidth();
> And, this is my grid field in class world:
> public GeomVectorField censusTracts = new GeomVectorField();
> However, MASON does not recognize the random. Am I missing a library? I've included the following libraries:
> import sim.field.geo.GeomVectorField;
> import sim.field.grid.*;
> import sim.util.*;
> How can I pull a random coordinate from a GeomVectorField?