namespace DoomDeathmatch.Script.Provider;

public class RandomListValueProvider<T> : IValueProvider<T>
{
  private readonly List<IValueProvider<T>> _providers = [];
  private readonly Random _random = new();

  public RandomListValueProvider(IEnumerable<IValueProvider<T>> parProviders)
  {
    foreach (var provider in parProviders)
    {
      _providers.Add(provider);
    }
  }

  public T GetValue()
  {
    return _providers[_random.Next(_providers.Count)].GetValue();
  }
}