I have an agent class that does things:
public class Agent {
private Context<Object> context;
private Geography<Object> geography;
public int id;
boolean female;
public Agent(Context<Object> context, Geography<Object> geography, int id, boolean female) {
this.id = id;
this.context = context;
this.geography = geography;
this.female = female;
}
... setters getters
... do things methods
}
In the context builder class, where my agents are added into the context (geographic space composed of latitude and longitude coordinates), I want to make a random percentage of my Agents female (female = true).
for (int i = 0; i < 100; i++) {
Agent agent = new Agent(context, geography, i, false);
int id = i++;
if(id > 50) {
boolean female = true;
}
context.add(agent);
//specifies where to add the agent
Coordinate coord = new Coordinate(-79.6976, 43.4763);
Point geom = fac.createPoint(coord);
geography.move(agent, geom);
}
I believe the code above constructs the last 50 agents as female. How can I make it so they are randomly created as female? I change the number of agents created quite a bit.