public static PestDetectedResult Generate(List <Pest> pests)
        {
            if (pests == null || pests.Count == 0)
            {
                return(null);
            }

            if (!DecisionHelper.ShouldDoAction(50))
            {
                return(null);
            }

            var rand       = new Random();
            var pestNumber = rand.Next(0, pests.Count);
            var count      = rand.Next(10, 200);

            return(new PestDetectedResult()
            {
                PestId = pests[pestNumber].Id,
                CountOnSquareMeter = count
            });
        }
Example #2
0
        public static WeedDetectedResult Generate(List <Weed> weeds)
        {
            if (weeds == null || weeds.Count == 0)
            {
                return(null);
            }

            if (!DecisionHelper.ShouldDoAction(50))
            {
                return(null);
            }

            var rand       = new Random();
            var weedNumber = rand.Next(0, weeds.Count);
            var count      = rand.Next(5, 100);

            return(new WeedDetectedResult()
            {
                WeedId = weeds[weedNumber].Id,
                Percentage = count
            });
        }