﻿namespace AsmodeeDigital.Common.Plugin.Manager.Random
{
    /// <summary>
    /// Unity implementation of random manager
    /// </summary>
    public class RandomManagerUnity : IRandomManager
    {
        /// <summary>
        /// Get the seed of the random number generator
        /// </summary>
        /// <returns>Seed</returns>
        public int GetSeed()
        {
            return UnityEngine.Random.seed;
        }

        /// <summary>
        /// Set the seed of the random number generator
        /// </summary>
        /// <param name="seed">Seed</param>
        public void SetSeed(int seed)
        {
            UnityEngine.Random.seed = seed;
            UnityEngine.Random.seed = seed;
        }

        /// <summary>
        /// Get random value in [0;1[ range
        /// </summary>
        /// <returns>Random value in [0;1[ range</returns>
        public float GetValue()
        {
            return UnityEngine.Random.value;
        }

        /// <summary>
        /// Get random value in [min;max[ range
        /// </summary>
        /// <param name="min">Minimum value (included)</param>
        /// <param name="max">Maximum value (excluded)</param>
        /// <returns>Random value in [min;max[ range</returns>
        public int GetValue(int min, int max)
        {
            return UnityEngine.Random.Range(min, max);
        }
    }
}
