Пример #1
0
        public double Normal(int mean = 1, int standardDeviation = 1)
        {
            var theta = 2 * Math.PI * _randomWrapper.NextDouble();
            var rho   = Math.Sqrt(-2 * Math.Log(1 - +_randomWrapper.NextDouble()));
            var scale = standardDeviation * rho;

            return(mean + scale * Math.Cos(theta));
        }
Пример #2
0
        static double GetRandomValue(IRandomWrapper random, int min, int max)
        {
            int    intPart   = random.Next(min, max);
            double floatPart = Math.Round(random.NextDouble(), 2);

            return(intPart + floatPart);
        }
Пример #3
0
        static Data CreateItem(int year, int month)
        {
            return(new Data()
            {
                Month = new DateTime(year, month, DateTime.DaysInMonth(year, month)),
                ConstructionIncome = random.Next(75000, 125000) + (decimal)random.NextDouble(),
                SalesIncome = random.Next(0, 1000),

                CostOfGoodsSold = random.Next(0, 3500) + (decimal)random.NextDouble(),
                JobExpenses = random.Next(5000, 35000) + (decimal)random.NextDouble(),

                Automobile = random.Next(300, 900) + (decimal)random.NextDouble(),
                BankServiceCharges = random.Next(10, 80),
                Insurance = random.Next(1000, 5000),
                PayrollExpenses = random.Next(9000, 18000),
                Repairs = random.Next(0, 400),
                ToolsAndMachinery = random.Next(0, 1000),
            });
        }
Пример #4
0
 public bool Boolean(double trueRatio = 0.5)
 {
     return(_randomWrapper.NextDouble() < trueRatio);
 }