問題我有這樣的代碼: 字符串文本中有與蘭德
if (text.Contains("{AVATAR}"))
text = Regex.Replace(text, "{AVATAR}", m => rand_avatars());
public string rand_avatars()
{
string[] text = avatars.ToArray();
Random rand = new Random(DateTime.Now.Millisecond);
return text[rand.Next(text.Length)];
}
一些{} AVATAR但替換出來後我收到來自頭像2個相同的字符串。爲什麼?
我有類似的問題:http://stackoverflow.com/questions/15162048/very-irdird-code-with-random-works-different-when-i-use-breakpoint – Kamil