Exemple #1
0
        /// <summary>
        /// Sequential data generator with unlimited capacity: generates repeated sequence starting from the seed and incrementing by the step
        /// Limit value is based on the data type.
        /// </summary>
        /// <typeparam name="TData">The type of the data.</typeparam>
        /// <param name="initialSeed">The initial seed of the generator</param>
        /// <param name="step">The amount to increment by</param>
        /// <returns>Sequential data generator with unlimited capacity.</returns>
        public static IDataGenerator <TData> RepeatedSequence <TData>(long initialSeed, long step)
        {
            long limit;

            if (!seedLimits.TryGetValue(typeof(TData), out limit))
            {
                limit = long.MaxValue;
            }

            return(new DelegatedSeededDataGenerator <TData>(
                       initialSeed,
                       FromSeedStrategies.ConvertSeed <TData>(),
                       TryGetNextSeedStrategies.RepeatedSequence(initialSeed, limit, step)));
        }
Exemple #2
0
 /// <summary>
 /// Sequential data generator that generates sequence starting from the seed converts it to the targeted type.
 /// </summary>
 /// <typeparam name="TData">The data type. Convertion using IConvertible must be supported from long to this type.</typeparam>
 /// <param name="initialSeed">The initial seed of the generator</param>
 /// <returns>Sequential data generator.</returns>
 public static IDataGenerator <TData> Sequence <TData>(long initialSeed)
 {
     return(new DelegatedSeededDataGenerator <TData>(
                initialSeed,
                FromSeedStrategies.ConvertSeed <TData>()));
 }