Example #1
0
 public static IEnumerable <string> GetRandomStringsWithoutSpaces(int n, int minLength, int maxLength, FastRandom rand)
 {
     for (int i = 0; i < n; i++)
     {
         yield return(StringValueGenerator.GetRandomStringWithoutSpaces(rand.Next(minLength, maxLength + 1), rand)); // +1 , because rand.Next is exclusive upperBound
     }
 }
Example #2
0
        private IEnumerable <string> GetStringWithSpaces(int n, FastRandom rand)
        {
            for (int i = 0; i < n; i++)
            {
                var value = StringValueGenerator.GetRandomStringWithoutSpaces(rand.Next(2, 20 + 1), rand).ToCharArray();

                // add 20% spaces
                for (int j = 0; j < value.Length; j++)
                {
                    if (rand.NextDouble() < 0.2)
                    {
                        value[j] = ' ';
                    }
                }
                yield return(new string(value));
            }
        }