Пример #1
0
 private string getRandom_int(Interval interval)
 {
     int min = Int32.Parse(interval.interval_a);
     int max = Int32.Parse(interval.interval_b);
     int r = random.Next(min, (max + 1));
     return r.ToString();
 }
Пример #2
0
 private string getRandom_float(Interval interval)
 {
     float min = float.Parse(interval.interval_a);
     float max = float.Parse(interval.interval_b);
     float r = min + ((float)(random.NextDouble())) * (max - min);
     return r.ToString("0.0");
 }
Пример #3
0
 // returns a list of all the values within the intervals
 private List<string> getAllValues_Int(Interval[] intervals)
 {
     int a = 0, b = 0;
     List<string> list = new List<string>();
     for (int i = 0; i < intervals.Length; i++)
     {
         a = Int32.Parse(intervals[i].interval_a);
         b = Int32.Parse(intervals[i].interval_b);
         while (a <= b)
         {
             list.Add(a.ToString());
             a = a + 1;
         }
     }
     return list;
 }
Пример #4
0
 private string getRandom_double(Interval interval)
 {
     double min = Double.Parse(interval.interval_a);
     double max = Double.Parse(interval.interval_b);
     double r = min + random.NextDouble() * (max - min);
     return r.ToString("0.0"); ;
 }
Пример #5
0
 // returns a list of all the values within the intervals
 private List<string> getAllValues_Float(Interval[] intervals)
 {
     float a = 0.0f, b = 0.0f;
     List<string> list = new List<string>();
     for (int i = 0; i < intervals.Length; i++)
     {
         a = float.Parse(intervals[i].interval_a);
         b = float.Parse(intervals[i].interval_b);
         while (a <= b)
         {
             a = float.Parse(Math.Round((Decimal)a, 1) + "");
             list.Add(a.ToString("0.0"));
             a = a + 0.1f;
         }
     }
     return list;
 }