/// 構造隨機數 種子static int GetRandomSeed(){ byte[] bytes = new byte[4]; System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider(); rng.GetBytes(bytes); return BitConverter.ToInt32(bytes, 0);} /// 生成隨機 數static int rnd() { Random ran = new Random(GetRandomSeed()); int cnt = ran.Next(0,59); return cnt; }
以上就是本文的全部內容了,希望大家能夠喜歡,能夠對大家學習C#有所幫助。
新聞熱點
疑難解答