12345678910111213141516171819202122232425262728293031 |
- namespace TBL.CSharp.Utilities.Random
- {
- /// <summary>
- /// 随机数发生器接口
- /// </summary>
- public interface IRandom
- {
- /// <summary>
- /// 获得下一个原随机数
- /// <para>未经处理的随机数,可能是任何 <c>int</c> 值(包括负数)</para>
- /// </summary>
- int NextRaw();
- }
- /// <summary>
- /// 支持用种子进行状态还原的随机数发生器接口
- /// </summary>
- /// <typeparam name="TSeed">随机种子类型</typeparam>
- public interface IRandom<TSeed> : IRandom
- {
- /// <summary>
- /// 存储当前的种子
- /// </summary>
- public TSeed DumpSeed();
- /// <summary>
- /// 从种子还原
- /// </summary>
- public void RestoreBySeed(TSeed seed);
- }
- }
|