public GetRandomInRange ( int radius, |
||
radius | int | |
rnd | ||
Résultat |
public Position GetRandomInRange(int radius, Random rnd)
{
return this.GetRandom(rnd.Next(radius + 1), rnd);
}
Position::GetRandomInRange ( int distanceMin, int distanceMax, |
public void GetRandomInRange() { var rnd = new Random(Environment.TickCount); var pos = new Position(10, 10); for (int i = 0; i < 10000; ++i) { var rndPos1 = pos.GetRandomInRange(10, rnd); Assert.InRange(pos.GetDistance(rndPos1), 0, 11); var rndPos2 = pos.GetRandomInRange(5, 10, rnd); Assert.InRange(pos.GetDistance(rndPos2), 4, 11); } }