Пример #1
0
        List <SalesData> generateSalesData(DateTime start, DateTime end)
        {
            // bogus product names
            var names = "Commodo LX,Ipsum TX,Tempor SJ,Aliqua FT,Veniam AJ,Nostrud XJ,Laboris S4,Aliquip T5," +
                        "Consequat SS,Pariatur GT,Volupta AR,Velitesse AA,Cillum C1,Fugiat WJ,Nullax RS";
            var products = names.Split(',');

            // random sales data
            var rnd  = new Random(0);
            var list = new List <SalesData>();

            for (int i = 0; i < products.Length; i++)
            {
                var avg   = (double)rnd.Next(1, 10);
                var stdev = avg / rnd.Next(1, 4);
                var trend = i > 3 ? 1 + rnd.NextDouble() / 5000 : 0;
                for (var dt = start; dt <= end; dt = dt.AddDays(1))
                {
                    var sd = new SalesData();
                    sd.DateShipped   = dt;
                    sd.ProductName   = products[i];
                    sd.TotalQuantity = GetNormal(rnd, avg, stdev);
                    list.Add(sd);
                    avg *= trend;
                }
            }
            return(list);
        }
Пример #2
0
        List<SalesData> generateSalesData(DateTime start, DateTime end)
        {
            // bogus product names 
            var names = "Commodo LX,Ipsum TX,Tempor SJ,Aliqua FT,Veniam AJ,Nostrud XJ,Laboris S4,Aliquip T5," +
                        "Consequat SS,Pariatur GT,Volupta AR,Velitesse AA,Cillum C1,Fugiat WJ,Nullax RS";
            var products = names.Split(',');

            // random sales data
            var rnd = new Random(0);
            var list = new List<SalesData>();
            for (int i = 0; i < products.Length; i++)
            {
                var avg = (double)rnd.Next(1, 10);
                var stdev = avg / rnd.Next(1, 4);
                var trend = i > 3 ? 1 + rnd.NextDouble() / 5000 : 0;
                for (var dt = start; dt <= end; dt = dt.AddDays(1))
                {
                    var sd = new SalesData();
                    sd.DateShipped = dt;
                    sd.ProductName = products[i];
                    sd.TotalQuantity = GetNormal(rnd, avg, stdev);
                    list.Add(sd);
                    avg *= trend;
                }
            }
            return list;
        }