/// <summary>
        /// Get a random grain reference.
        /// </summary>
        /// <typeparam name="TGrainKey">The grain key type.</typeparam>
        /// <typeparam name="TGrainGeneric">The type of the generic part of a grain.</typeparam>
        /// <param name="keyExtension">Should an extension key be defined or not.</param>
        /// <returns>Random value of the given type.</returns>
        /// <exception cref="ArgumentException"/>.
        internal static GrainReference GetRandomGrainReference <TGrainKey, TGrainGeneric>(SymbolSet symbolSet, long symbolCount = 15, bool keyExtension = false)
        {
            if (symbolSet == null)
            {
                throw new ArgumentNullException(nameof(symbolSet));
            }

            Func <Type, bool, object, GrainReference> func;

            if (GrainReferenceTypeSwitch.TryGetValue(typeof(TGrainKey), out func))
            {
                return(func(typeof(TGrainGeneric), keyExtension, Tuple.Create(new Range <long>(symbolCount, symbolCount), symbolSet)));
            }

            throw new ArgumentException(typeof(TGrainKey).Name);
        }
 /// <summary>
 /// Get random symbols.
 /// </summary>
 /// <param name="symbolSet">The set of symbols from which the random characters are drawn from.</param>
 /// <param name="count">The count of random symbols.</param>
 /// <returns>A random string.</returns>
 /// <exception><see cref="ArgumentNullException"/>.
 /// <exception cref="ArgumentOutOfRangeException"/>.
 public static string GetRandomCharacters(SymbolSet symbolSet, long count)
 {
     return(GetRandomCharacters(symbolSet, new Range <long>(count, count)));
 }