C# 随机数出现的概率金币和钱包.\x0b几率:金币50%,钱包20%,无东西30%

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/26 18:26:37

C# 随机数出现的概率
金币和钱包.\x0b几率:金币50%,钱包20%,无东西30%

namespace ConsoleApplication1
{
\x05class Program
\x05{
\x05\x05static void Main(string[] args)
\x05\x05{
\x05\x05\x05Random r = new Random();
\x05\x05\x05//随机产生0到99直接的一个数,可随机产出100个不同的数
\x05\x05\x05int num = r.Next(0,100);
\x05\x05\x05if (num>=0&&num=50&&num=70&&num