Example #1
0
        public static List<Person> Generate(List<Person> ps, int nbToGenerate, BootstrapStrategy strat)
        {
            int length = ps.Count;
            Random gen = new Random();

            List<Person> ret = new List<Person>();
            if (strat == BootstrapStrategy.RE_USE)
            {
                ret = new List<Person>(ps);
                for (int i = 0; i < nbToGenerate; i++)
                {
                    int index = gen.Next(length);
                    ret.Add(ps[index]);
                }
            }
            else if (strat == BootstrapStrategy.TOTAL_NEW)
            {
                for (int i = 0; i < nbToGenerate; i++)
                {
                    int index = gen.Next(length);
                    ret.Add(ps[index]);
                }
            }
            else
                throw new Exception();

            return ret;
        }
Example #2
0
 public static List<Person> Generate(List<Person> ps, double rate, BootstrapStrategy strat)
 {
     int length = ps.Count;
     int nbToGenerate = (int)(rate * length);
     return Generate(ps, nbToGenerate, strat);
 }