Пример #1
0
        public static bool GetBoolean(float chance, int checkInterval)
        {
            if (checkInterval > 0)
            {
                if (Environment.TickCount - _lastCheckedTime < checkInterval)
                {
                    return(false);
                }

                else
                {
                    _lastCheckedTime = Environment.TickCount;
                }
            }

            return(StrongRandom.Next(0, 1000) < (int)(chance * 1000.0f));
        }
Пример #2
0
        /// <summary>
        /// Gets a random integer value in range
        /// </summary>
        /// <param name="abs">Return the absolute value.</param>
        /// <returns></returns>
        public static int GetInteger(int min, int max, bool abs)
        {
            int result = StrongRandom.Next(min, max);

            return(abs ? Math.Abs(result) : result);
        }