Exemplo n.º 1
0
        public ICollection <ISymbol> GetSample(int size)
        {
            var sample = new List <ISymbol>();

            while (sample.Count < size)
            {
                try
                {
                    var seed = (decimal)_random.NextDouble();

                    sample.Add(_seqProbabilities
                               .Single(p => seed >= p.Value.Item1 &&
                                       seed < p.Value.Item2).Key);
                }
                catch
                {
                    throw new IndexOutOfRangeException("Something went wrong. Sorry. Please try again. Problem with the sample generation.");
                }
            }

            return(sample);
        }