從指定的數組中,隨機抽取一個數

int[] arrViewCount = new int[] { 1, 3, 5, 7, 9, 2, 4, 6, 8 };            
Random r = new Random();
int n = r.Next(0, arrViewCount.Length - 1);
Response.Write(arrViewCount[n].ToString());

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