复制代码 代码如下:
namespace RandomTest
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 100; i++)
{
Random d = new Random();
Console.WriteLine(d.Next(100));
}
}
}
}
复制代码 代码如下:
namespace RandomTest
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 100; i++)
{
Random d = new Random();
Thread.Sleep(15);
Console.WriteLine(d.Next(100));
}
}
}
}
复制代码 代码如下:
namespace RandomTest
{
class Program
{
static void Main(string[] args)
{
Random d = new Random();
for (int i = 0; i < 100; i++)
{
Console.WriteLine(d.Next(100));
}
}
}
}
复制代码 代码如下:
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 );
}
Random random = new Random( GetRandomSeed( ) );
新闻热点
疑难解答
图片精选