我有一個錯誤嘗試做下面的代碼如何做一個隨機數字?
Random r = new Random();
r.Next(10, 100);
但我有一個錯誤:
Error 1 'ChaseRP_Admin_Control.AdminCP2.Random' does not contain a definition for 'Next' and no extension method 'Next' accepting a first argument of type 'ChaseRP_Admin_Control.AdminCP2.Random' could be found (are you missing a using directive or an assembly reference?)
C:\Users\Someone\documents\visual studio 2013\Projects\ChaseRP Admin Control\ChaseRP Admin Control\AdminCP2\Random.cs 24 39 ChaseRP Admin Control
呃,你是否創建了一個名爲'Random'的類? – Novak
你似乎已經定義了你自己的Random類(在'Random.cs'中)。您沒有使用.Net框架中的System.Random。 – Blorgbeard