Source/NFX/Parsing/NaturalTextGenerator.cs
/// <summary>
/// Generates a string that resembles a city name
/// </summary>
Generates a string that resembles a city name
Generates a string that resembles a city name
public static string GenerateCityName()
    {
      var rnd = ExternalRandomGenerator.Instance.NextRandomInteger;
      if (rnd<-1750000000)
        return POPULAR_CITY_NAMES[(0x7fFFFFFF & rnd) % POPULAR_CITY_NAMES.Length];
      string prefix;
      if (rnd>0)
        prefix = POPULAR_FIRST_NAMES[(0x7fFFFFFF & ExternalRandomGenerator.Instance.NextRandomInteger) % POPULAR_FIRST_NAMES.Length];
      else
        prefix = POPULAR_LAST_NAMES[(0x7fFFFFFF & ExternalRandomGenerator.Instance.NextRandomInteger) % POPULAR_LAST_NAMES.Length];
      var suffix = CITY_SUFFIXES[(0x7fFFFFFF & rnd) % CITY_SUFFIXES.Length];
      prefix = Char.ToUpperInvariant(prefix[0]) + prefix.Substring(1).ToLowerInvariant();
      return prefix + suffix;
    }
public static string GenerateCityName ( ) { var rnd = ExternalRandomGenerator . Instance . NextRandomInteger ; if ( rnd < - 1750000000 ) return POPULAR_CITY_NAMES [ ( 0x7fFFFFFF & rnd ) % POPULAR_CITY_NAMES . Length ] ; string prefix ; if ( rnd > 0 ) prefix = POPULAR_FIRST_NAMES [ ( 0x7fFFFFFF & ExternalRandomGenerator . Instance . NextRandomInteger ) % POPULAR_FIRST_NAMES . Length ] ; else prefix = POPULAR_LAST_NAMES [ ( 0x7fFFFFFF & ExternalRandomGenerator . Instance . NextRandomInteger ) % POPULAR_LAST_NAMES . Length ] ; var suffix = CITY_SUFFIXES [ ( 0x7fFFFFFF & rnd ) % CITY_SUFFIXES . Length ] ; prefix = Char . ToUpperInvariant ( prefix [ 0 ] ) + prefix . Substring ( 1 ) . ToLowerInvariant ( ) ; return prefix + suffix ; }
Generates a string that resembles a city name
Generates a string that resembles a city name