ASP.NET返回随机数

Code

调用时只需要 string code = RndNum(4);

这样取得了4位随机数.

如果需要字母随机数,则
        string Vchar = "0,1,2,3,4,5,6,7,8,9,A,B";把字母加上去.

同时修改int t = rand.Next(9);中的9改成Vchar的长度但可.

我的淘宝店:http://hamby.taobao.com
原文地址:https://www.cnblogs.com/hambywu/p/1602382.html