C# Random随机数 作者:马育民 • 2025-06-24 13:58 • 阅读:10000 # 介绍 用 Random 产生指定范围随机数(整数随机数) ### 产生指定上限的随机数 如产生100以内的随机数 ``` Random ran = new Random(); int n = ran.Next(100); ``` ### 产生指定上下限的随机数 如产生100到1000的随机数 ``` Random ran = new Random(); int n = ran.Next(100, 1000); ``` 原文出处:http://malaoshi.top/show_1GW1MurmmjeP.html