using System; using System.Collections; using System.Collections.Generic; using
System.Linq; namespace Core.Util { /// <summary> /// Random随机数帮助类 /// </summary>
public static class RandomHelper { private static Random _random { get; } = new
Random(); /// <summary> /// 下一个随机数 /// </summary> /// <param
name="minValue">最小值</param> /// <param name="maxValue">最大值</param> ///
<returns></returns> public static int Next(int minValue, int maxValue) { return
_random.Next(minValue, maxValue); } /// <summary> /// 下一个随机值 /// </summary> ///
<typeparam name="T">值类型</typeparam> /// <param name="source">值的集合</param> ///
<returns></returns> public static T Next<T>(IEnumerable<T> source) { return
source.ToList()[Next(0, source.Count())]; } } }

技术
友情链接
码工具
Toolsou
API参考文档
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信