摘要: 默认情况下,.NET的随机数是根据系统时间来生成的,如果电脑速度很快的话,生成的随机数就会一样。Random rnd = new Random();int rndNum = rnd.Next(); //int 取值范围内的随机数int rndNum = rnd.Next(10); //得0~9的随机数int rndNum = rnd.Next(10,20); //得10~19的随机数int rndNum = rnd.NextDouble(); //得0~1的随机数 若随机种子为系统时间,用循环一次生成多个随机数.因为CPU运算速度太快了,所以每次取到的都是同一个时间.即生成的... 阅读全文
posted @ 2012-09-10 01:18 乱炖er 阅读(6057) 评论(0) 推荐(0) 编辑
摘要: 1> 图片转二进制public byte[] GetPictureData(string imagepath){/**/////根据图片文件的路径使用文件流打开,并保存为byte[]FileStream fs = new FileStream(imagepath, FileMode.Open);//可以是其他重载方法byte[] byData = new byte[fs.Length];fs.Read(byData, 0, byData.Length);fs.Close();return byData;}//或者使用public byte[] PhotoImageInsert(Syste 阅读全文
posted @ 2012-09-10 01:14 乱炖er 阅读(31193) 评论(0) 推荐(3) 编辑