SystemGenerator.cs 552 B

12345678910111213141516171819
  1. namespace TBL.CSharp.Utilities.Random.Generator
  2. {
  3. /// <summary>
  4. /// 系统自带的随机数发生器
  5. /// <para>一般用于系统功能;由于不同设备的实现差异,因此不支持种子存取</para>
  6. /// </summary>
  7. public class SystemGenerator : System.Random, IRandom
  8. {
  9. /// <summary>
  10. /// 从种子构造
  11. /// </summary>
  12. /// <param name="seed">种子值</param>
  13. public SystemGenerator(int seed) : base(seed)
  14. {
  15. }
  16. public int NextRaw() => Next();
  17. }
  18. }