所以我在VB6中有以下代码
string CharString = "KO0LPBGt7HU8NJI9acfDXESvgbYujmikolpw3MZWAQyhn6TFCR1q2Vzse4xdr5";
string DatePassword = string.Empty;
float x = VBMath.Rnd(-1);
DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
x = VBMath.Rnd(-1);
VBMath.Randomize(dt.ToOADate());
for (int i=0; i<6; i++)
{
double y = Math.Truncate(VBMath.Rnd()*62);
DatePassword += CharString.Substring( Convert.ToInt32(y), 1);
}
我无法将此代码转换为C#。特别是如何调用随机化种子是双重的。这是我在C#中的尝试
string CharString = "KO0LPBGt7HU8NJI9acfDXESvgbYujmikolpw3MZWAQyhn6TFCR1q2Vzse4xdr5";
string DatePassword = string.Empty;
Random rnd = new Random(-1);
float x = rnd.Next();
DateTime dt = new DateTime(DateTime.Now.Year + DateTime.Now.Month + 1);
x = rnd.Next();
double z = rnd.NextDouble() * dt.ToOADate();
for (int i = 0; i < 6; i++)
{
x = rnd.Next();
double y = Math.Truncate(x * 62);
DatePassword += CharString.Substring(Convert.ToInt32(y), 1);
}