random类的使用

小栗子a如下:

string[] punch = new[]  { "石头", "剪刀", "" };
string myPunch;
public string MyPunch
    {
       get
         {
           Random random = new Random();
           int Index = random.Next(3);
           myPunch = punch[Index].ToString();
           return myPunch;
         }
    }
原文地址:https://www.cnblogs.com/miaoying/p/5019015.html