Example #1
0
 public static void ResetRng(RngId rngId, int offset = 0)
 {
     if (rngId.IsDebugLog())
     {
         Log.Verbose(LogGroups.Random, string.Format("ResetRng {0} [{1}]", rngId, offset));
     }
     if (!rngId.IsResetable())
     {
         Log.Error(LogGroups.Random, string.Format("RandomManager.Reset: type {0} is not allowed to be reset", rngId));
     }
     else
     {
         GetRng(rngId).Reset(offset);
     }
 }
Example #2
0
        public static int Range(int min, int max, RngId rngId)
        {
            rngId = ConvertRngId(rngId);
            AssertNotCalledInPreviewMode(rngId);
            if (rngId.IsReserved())
            {
                Log.Error(LogGroups.Random, string.Format("RandomManager.Range: type {0} is reserved.  It can't be used for Range.", rngId));
                return(min);
            }
            int num = GetRng(rngId).Range(min, max);

            if (rngId.IsDebugLog())
            {
                Log.Verbose(LogGroups.Random, string.Format("RangeInt {0} [{1} {2}] [{3}]", rngId, min, max, num));
            }
            return(num);
        }