public FrequencyElementGenerator(IEnumerable <T> elements)
        {
            elements.ThrowIfNull("elements");

            var counts = new Dictionary <T, float>();

            foreach (var element in elements)
            {
                if (counts.ContainsKey(element))
                {
                    counts[element]++;
                }
                else
                {
                    counts[element] = 1;
                }
            }

            var indexGenerator = new FrequencyIntGenerator(counts.Values);

            elementGenerator = new ListSelectorGenerator <T>(counts.Keys, indexGenerator);
        }
        public RandomElementGenerator(IEnumerable <T> list)
        {
            list.ThrowIfNull("list");

            generator = new ListSelectorGenerator <T>(list, new UniformIntGenerator(list.Count()));
        }