Beispiel #1
0
 public int FindStateIdx(RngId rngId)
 {
     for (int i = 0; i < _rngStates.Count; i++)
     {
         if (_rngStates[i].rngIdName == rngId.ToString())
         {
             return(i);
         }
     }
     return(-1);
 }
Beispiel #2
0
        public int AddState(RngId rngId, int seed)
        {
            if (HasState(rngId))
            {
                Log.Error(LogGroups.Random, string.Format("RandomState.AddState: State already exists: {0}", rngId));
                return(FindStateIdx(rngId));
            }
            State item = new State
            {
                rngIdName = rngId.ToString(),
                rng       = new NiceRNG(seed)
            };

            _rngStates.Add(item);
            return(FindStateIdx(rngId));
        }