Random在生成随机数时添加一个随机因子会大大提高数据的随机性,如果不添加会产生相同的随机数出来
byte[] buffer = Guid.NewGuid().ToByteArray(); int iSeed = BitConverter.ToInt32(buffer, 0); Random random = new Random(iSeed);int num = random.Next(0, 1000);