Aura.Channel.World.Position.GetRandomInRange C# (CSharp) Метод

GetRandomInRange() публичный Метод

Returns random position in radius around this position.
public GetRandomInRange ( int radius, Random rnd ) : Position
radius int
rnd System.Random
Результат Position
		public Position GetRandomInRange(int radius, Random rnd)
		{
			return this.GetRandom(rnd.Next(radius + 1), rnd);
		}

Same methods

Position::GetRandomInRange ( int distanceMin, int distanceMax, Random rnd ) : Position

Usage Example

Пример #1
0
		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);
			}
		}
All Usage Examples Of Aura.Channel.World.Position::GetRandomInRange