C#隨機生成指定範圍內的decimal

請防止你的狗友惡意遠程給你關機!!ps:等我學有所成第一個入侵你家攝像機(手動陰險)

using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                decimal b = 0.35M;
                int c = (int)(b * 100 - 10);
                int d = (int)(b * 100);
                Console.WriteLine(c);
                Console.WriteLine(d);
                decimal a = new Random().Next(c, d) / (decimal)100;
                Console.WriteLine(a);
                Console.ReadKey();
            }
        }
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章