public bool Die(float c) { if (UDeath == 0) { //Step 1, initialize UDeath = RandomFloat.NextFloat(); BDeath = 0; } float BNext = BDeath + h(c, -0.001f, 0.035f) * (1 - BDeath); //Step 2 if (BNext > UDeath) { //Tumble and return to step 1 UDeath = 0; BDeath = 0; return(true); } else { //Keep running, and return to step 2 BDeath = BNext; return(false); } }
public static CenterObjectV1 NextPosition() { return(new CenterObjectV1 { Type = "Point", Coordinates = new double[] { RandomFloat.NextFloat(-180, 168), // Longitude RandomFloat.NextFloat(-90, 90), // Latitude } }); }
public static BeaconV1 NextBeacon(int siteCount = 100) { return(new BeaconV1() { Id = IdGenerator.NextLong(), SiteId = NextSiteId(siteCount), Udi = IdGenerator.NextShort(), Label = RandomString.NextString(10, 25), Type = NextBeaconType(), Radius = RandomFloat.NextFloat(3, 150), Center = NextPosition() }); }
public bool DecideState(float c) { SolveStiff(c); double r = RandomFloat.NextFloat(); if (S > U) { S = 0.0f; U = RandomFloat.Range(0f, 0.8f); return(false); //Tumbling } else { return(true); //Running } }
public bool DecideState(float c) { float dC = c - l; l = c; if (U == 0) { //Step 1, initialize U = RandomFloat.NextFloat(); B = 0; } float BNext = B + h(dC) * (1 - B); //Step 2 if (BNext > U) { //Tumble and return to step 1 U = 0; B = 0; return(false); //Tumble } else { //Keep running, and return to step 2 B = BNext; return(true); //Run } }