Exemplo n.º 1
0
        public void BetweenTest()
        {
            const int minimum = 1;
            const int maximum = 4;

            AssertBetween(Random.Between(minimum, maximum), minimum, maximum);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a random time span between the given ones based on
        /// their millisecond properties.
        /// </summary>
        /// <param name="rnd"></param>
        /// <param name="minTimeSpan"></param>
        /// <param name="maxTimeSpan"></param>
        /// <returns></returns>
        public static TimeSpan Between(this Random rnd, TimeSpan minTimeSpan, TimeSpan maxTimeSpan)
        {
            var min = (float)minTimeSpan.TotalMilliseconds;
            var max = (float)maxTimeSpan.TotalMilliseconds;

            return(TimeSpan.FromMilliseconds(rnd.Between(min, max)));
        }
Exemplo n.º 3
0
 private void InitEntities()
 {
     for (var i = 0; i < 1000; i++)
     {
         _toAdd.Add(new GameEntity
         {
             Id      = Guid.NewGuid().ToString(),
             Type    = "food",
             Name    = $"Entity {i}",
             X       = R.Between(Info.XMin + 50, Info.XMax - 50),
             Y       = R.Between(Info.YMin + 50, Info.YMax - 50),
             DX      = R.Between(-EntityMaxSpeed, EntityMaxSpeed, 1),
             DY      = R.Between(-EntityMaxSpeed, EntityMaxSpeed, 1),
             Updated = 0
         });
     }
 }